-
Notifications
You must be signed in to change notification settings - Fork 85
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
Implement 'humanize_error' for voluptuous' validation #3198
Comments
Your issue doesn't follow our guidelines. Please fix the following:
Click here for details. Thank you! 🙏 |
Thank you, everything looks good now! |
The root@trusty64:/home/vagrant# cat test.py
from voluptuous import Schema, Required, All, Length, Range
from voluptuous.humanize import humanize_error
schema = Schema({
Required('q'): All(str, Length(min=1)),
Required('per_page'): All(int, Range(min=1, max=20)),
Required('page'): All(int, Range(min=0)),
})
try:
data = {'q': 123}
schema(data)
except Exception as e:
print humanize_error(data, e)
root@trusty64:/home/vagrant#
root@trusty64:/home/vagrant#
root@trusty64:/home/vagrant#
root@trusty64:/home/vagrant# python test.py
expected str for dictionary value @ data['q']. Got 123
required key not provided @ data['page']. Got None
required key not provided @ data['per_page']. Got None |
For the dataset validation, we should include the corresponding |
We actually decided to implement |
#3198: Generate verbose 'voluptuous' errors
We need to implement
MultipleInvalid
for our voluptuous validation, since we are currently implementing theexcept Exception, error
case, which only generates a single error, when many could be possible:The text was updated successfully, but these errors were encountered: