-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add custom validator error names #50
base: master
Are you sure you want to change the base?
Add custom validator error names #50
Conversation
Currently I can live without this by mapping the validation error name to the error message I want, but it seems like an extra step that could be done without. |
Hi @eden-omb, Thanks for your PR. I'll get back to you as soon as I can |
Excellent! I'm really not sure if this is the best way to go about this, and doesn't really solve things like the |
I was about to do this same PR because I loved the library but hated the error mapping part |
please @chainlist let me know how I can help this move forwards, I think this change won't affect negatively to anyone, is just an extra feature that is not required of use by anyone that doesn't want to |
Title, basically. Currently it's impossible to override the uninformative and unlocalized validation errors. When unsatisfied, the
required()
validator simply printsrequired
, a bad URL printsurl
, invalid email printsnot_an_email
, etc.This PR adds the ability to pass along a custom name, such that one could optionally call e.g.
between(5, 10, "Must be between 5 and 10")
.