File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,24 @@ curl -X QUERY "http://localhost:3000/v1/validate" -H "Content-Type: application/
5959}
6060```
6161
62+ ### Example error response
63+
64+ All error responses are returned using the ` application/problem+json ` media type,
65+ in accordance with [ RFC 9457] ( https://www.rfc-editor.org/rfc/rfc9457.html ) .
66+
67+ ``` http
68+ HTTP/1.1 400 Bad Request
69+ Content-Type: application/problem+json
70+ ```
71+
72+ ``` json
73+ {
74+ "title" : " empty body" ,
75+ "detail" : " need a body to validate" ,
76+ "status" : 400
77+ }
78+ ```
79+
6280## Contributing
6381
6482Contributing is always appreciated, see [ CONTRIBUTING.md] ( CONTRIBUTING.md ) .
Original file line number Diff line number Diff line change 66
77 "github.com/gofiber/fiber/v2"
88 publiccodeParser "github.com/italia/publiccode-parser-go/v5"
9+ "github.com/italia/publiccode-validator-api/internal/common"
910)
1011
1112type PubliccodeymlValidatorHandler struct {
@@ -43,9 +44,7 @@ func (vh *PubliccodeymlValidatorHandler) Query(ctx *fiber.Ctx) error {
4344 // }
4445
4546 if len (ctx .Body ()) == 0 {
46- return ctx .Status (fiber .StatusBadRequest ).JSON (fiber.Map {
47- "error" : "empty body" ,
48- })
47+ return common .Error (fiber .StatusBadRequest , "empty body" , "need a body to validate" )
4948 }
5049
5150 results := make (publiccodeParser.ValidationResults , 0 )
You can’t perform that action at this time.
0 commit comments