-
Notifications
You must be signed in to change notification settings - Fork 219
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
Improvement: Schema build to report what custom validator failed #277
Comments
Hey @JohanLorenzo Thanks for reaching out to us. We are happy that Voluptuous is being used at Mozilla. We also aim to make the error more human-readable/friendly. I guess the issue is with the message displayed when custom validators are added in Voluptuous. Can you please give a small concrete schema example which tells what the required inputs and expected outputs are? Thanks. |
This feels like it would be useful for debugging, but not so much for users? Perhaps adding context to the exception would be sufficient, such as a reference to the validator that failed, though it would be quite a lot of work to add it everywhere. What do you think @tusharmakkar08 ? |
Hey guys! Yeah, this will only be useful for debugging. I think if the function name is just added to the error message, that's gonna be helpful enough. For example, this small schema highlights the issue. The expected output to me is: the same error message which contains the validator name. |
@alecthomas Yes, this will be only useful for debugging purpose but as @JohanLorenzo mentioned it can reduce the debugging time phenomenally (Half a day to maybe few minutes). I am not however sure about the effort which would incur in incorporating the change. Would need to look into it. |
Thank you very much for this library 😃 Mozilla uses it to validate structured dictionaries in several projects. For instance this and that ones.
I noticed an improvement we could make when custom validators are failing. As of now, schema builders don't tell what function failed. This cost me about half a day to understand that
task_provisionerId_test()
(in link 2) was causing the error:(
task
being a fairly-sized dict). The bug was definitely on our side. Nonetheless, I think a simpler error would have been:Long story short, I made a reduced test case which fits in a few lines.
The text was updated successfully, but these errors were encountered: