Skip to content

Commit

Permalink
fix: count anyOf rule as 1 occurence only (datreeio#689)
Browse files Browse the repository at this point in the history
* fix: count anyOf rule as 1 occurence only

* fix: better comment
  • Loading branch information
myishay authored Jun 16, 2022
1 parent 280adb0 commit db614a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/jsonSchemaValidator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ func getLeafErrors(error jsonschema.Detailed) []jsonschema.Detailed {
if error.Errors == nil {
// if no more child errors, I am a leaf, return me!
return []jsonschema.Detailed{error}
} else if strings.HasSuffix(error.KeywordLocation, "anyOf") {
// if I am an anyOf node, return as if I am a leaf
return []jsonschema.Detailed{error}
} else {
// if I'm not a leaf, return the errors from all my children!
var errorsFromChildren []jsonschema.Detailed
Expand Down

0 comments on commit db614a3

Please sign in to comment.