File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,22 @@ curl -X QUERY "http://localhost:3000/v1/validate" -H "Content-Type: application/
5757 }
5858 ]
5959}
60+
61+ ### Example error response
62+
63+ All error responses are returned as [application/problem+json](https://www.rfc-editor.org/rfc/rfc9457.html)
64+
65+ ```http
66+ HTTP/1.1 400 Bad Request
67+ Content-Type: application/problem+json
68+ ```
69+
70+ ```json
71+ {
72+ "title": "empty body",
73+ "detail": "need a body to validate",
74+ "status": 400
75+ }
6076```
6177
6278## Contributing
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