Skip to content

Commit

Permalink
Set path for all specific validators when set on SchemaValidator
Browse files Browse the repository at this point in the history
Currently if we set the path for the SchemaValidator after creation it
does not propagate down to the specific validators embedded within. That
means that subsequent SchemaValidators that are created by the specific
validators will have the wrong path. This updates to set the path for
all specific validators when it is set on their parent SchemaValidator.

Signed-off-by: hasheddan <[email protected]>
  • Loading branch information
hasheddan committed Dec 8, 2021
1 parent ec1f4c8 commit d5a90d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/validation/validate/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func NewSchemaValidator(schema *spec.Schema, rootSchema interface{}, root string
// SetPath sets the path for this schema validator
func (s *SchemaValidator) SetPath(path string) {
s.Path = path
for _, v := range s.validators {
v.SetPath(path)
}
}

// Applies returns true when this schema validator applies
Expand Down

0 comments on commit d5a90d6

Please sign in to comment.