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

Investigate if we can improve schema Validation Error reporting #163

Open
Athanasius opened this issue Jan 11, 2022 · 2 comments
Open

Investigate if we can improve schema Validation Error reporting #163

Athanasius opened this issue Jan 11, 2022 · 2 comments
Labels
enhancement python Pull requests that update Python code

Comments

@Athanasius
Copy link
Contributor

We use the jsonschema module to validate messages against our schemas.

At least in the manner we currently utilise it some of the messages for failed validation aren't as useful as they could be.

e.g. if someone attempts to send data containing a key that the schema has tagged 'disallowed', then the reported error is something like:

"[<ValidationError: "{'type': ['array', 'boolean', 'integer', 'number', 'null', 'object', 'string']} is not allowed for 'BadVALUE'">]

which is citing the value of the disallowed key when it would be more useful to cite the name of the key.

Hopefully, certainly in whatever version is current for python 3.9+, we can improve on this. If needs be we can investigate any alternative modules for validation.

@Athanasius Athanasius added enhancement python Pull requests that update Python code labels Jan 11, 2022
@Athanasius
Copy link
Contributor Author

https://python-jsonschema.readthedocs.io/en/stable/errors/

Specifically: https://python-jsonschema.readthedocs.io/en/stable/errors/#jsonschema.exceptions.ValidationError.json_path bit will help improve it.

@Tkael
Copy link
Member

Tkael commented Sep 4, 2022

Looks like useful feedback to pass back to clients, certainly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

2 participants