-
-
Notifications
You must be signed in to change notification settings - Fork 170
All values fail against the false schema when additionalProperties is set to false #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't see how this is a bug. A The way the spec is worded, any properties not validated by another "properties" keyword are validated against the subschema in We are currently looking at removing the "annotation" behavior that drives this and returning to the draft 7 language where the keyword instead looks at its sibling keywords directly to determine which properties to assess. Please see json-schema-org/json-schema-spec#1154 for more info. |
Thanks for the quick reply. However when additionalProperties is set to false (default setup in my case) why are all the "All values fail against the false schema" errors being reported for each property of the top level schema whereas the validation error is linked to just one property missing in the subschema ? In the provided sample this is trivial, however in the case of complex schemas, it is almost impossible to locate the source of the validation failure due to all the noise generated (over 200 errors for 1 missing field) - errors are being reported on fields which are correct which is misleading for the users. Or maybe is it possible to fine tune the validation output format ? |
This is due to the aforementioned annotation behavior.
When I agree: this is a weird side effect of the annotation behavior, and I'm not sure that we (the JSON Schema team) fully understood all of this when we put this behavior in. It was intended to make things simpler (for implementers) by providing a model to describe how keywords could interact. Instead it made failures harder to debug for schema authors (who should be the real focus, IMO). |
Environment
Describe the bug
First and before : Kudos for the awesome job 😍
Potentially related to #216
When validating a faulty schema with additionalProperties set to false, validation yields extraneous error messages ("All values fail against the false schema") those extraenous messages are not present when additionalProperties is set to true
To Reproduce
Schema
The following sample is missing the isConfirmed property
This generates the following validation errors :
Setting additionalProperties is set to true only one validation error is raised
Expected behavior
Behavior should be consistent independently from the additionalProperty property and should only report the first error
The text was updated successfully, but these errors were encountered: