jsonschema
jsonschema copied to clipboard
Error message for "additionalProperties" not easily reproducible with data available in the ValidationError
This is a follow-up to the discussion in #971 (sorry for the delay).
To reproduce the error message of "additionalProperties", some preprocessing needs to be done based on the data readily available in the ValidationError.
Especially, the offending properties are computed with private function find_additional_properties
.
Hi. I'd like to add a +1 for getting this fixed as I've hit the same problem. It's also an issue for "required" properties - the error object does not hold the name of the missing required key making it cumbersome to reformat the error message. Thanks for this great package though!
Linking to https://github.com/python-jsonschema/jsonschema/issues/119
Also to +1 this issue.
+1 to this issue and #119
My use case is as follows:
There are existing community supported schemas that have additionalProperties: false
I would prefer to catch in code any additional properties that have been added to the instances, rather than modify the schemas. In order to determine if the additional property is one of the known ones, or something that should cause a validation error, I would need to inspect the .message string. Then I would need to remove the properties that I know about, and raise the error without them... thus having the property names reported in the Error would be immensely useful