Skip to content
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

Error message for "additionalProperties" not easily reproducible with data available in the ValidationError #992

Open
pierrecamilleri opened this issue Aug 31, 2022 · 3 comments
Labels
Bug Something doesn't work the way it should. Error Reporting Issues related to clearer or more robust validation error reporting

Comments

@pierrecamilleri
Copy link

pierrecamilleri commented Aug 31, 2022

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.

@Julian Julian added Bug Something doesn't work the way it should. Error Reporting Issues related to clearer or more robust validation error reporting labels Aug 31, 2022
@LukeJones123
Copy link

LukeJones123 commented Oct 31, 2022

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!

@odscjames
Copy link

Linking to #119

Also to +1 this issue.

@azaroth42
Copy link

+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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something doesn't work the way it should. Error Reporting Issues related to clearer or more robust validation error reporting
Projects
None yet
Development

No branches or pull requests

5 participants