Skip to content

Commit cfcfa72

Browse files
committed
feat: add "results" to the response
1 parent fb2bce2 commit cfcfa72

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

internal/handlers/validate.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ func (vh *PubliccodeymlValidatorHandler) Query(ctx *fiber.Ctx) error {
4343

4444
reader := bytes.NewReader(ctx.Body())
4545

46+
results := make(publiccodeParser.ValidationResults, 0)
47+
4648
// parsed, err = parser.Parse(repository.FileRawURL)
4749
_, err := vh.parser.ParseStream(reader)
4850
if err != nil {
@@ -52,12 +54,11 @@ func (vh *PubliccodeymlValidatorHandler) Query(ctx *fiber.Ctx) error {
5254
for _, res := range validationResults {
5355
if errors.As(res, &validationError) {
5456
valid = false
55-
56-
break
5757
}
58+
results = append(results, res)
5859
}
5960
}
6061
}
6162

62-
return ctx.JSON(fiber.Map{"valid": valid})
63+
return ctx.JSON(fiber.Map{"valid": valid, "results": results})
6364
}

0 commit comments

Comments
 (0)