Inaccurate error message while using "unevaluatedProperties": False #1169
Labels
Enhancement
Some new desired functionality
Error Reporting
Issues related to clearer or more robust validation error reporting
I am using jsonschema to validate JSON data against a schema using "unevaluatedProperties": False. When my data contains an unexpected property, the error message lists all the evaluated properties as unexpected, instead of the actual unevaluated property.
Here is a schema as an example:
And here is a json data:
In this case, 'cc' under 'state' is unexpected. If I remove 'cc', the validation is successful. However, the error message reported by jsonschema is: jsonschema.exceptions.ValidationError: Unevaluated properties are not allowed ('city', 'state', 'street_address' were unexpected).
My questions are:
Why is the error message not mentioning 'cc', the actual cause of the error?
Are there any better ways to provide compatibility with the unevaluatedProperties keyword that could help us identify the specific unevaluated properties?
Please let me know if you need additional details.
Information about my current environment:
Python version: 3.7.16
jsonschema version: 4.16.0
Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: