-
Notifications
You must be signed in to change notification settings - Fork 225
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
[Feature Request] Ability to set validator #8
Comments
I don't really see the motivation. How is it easier than just validating the value of Foo after it has been decoded? |
Yes, not much but ...some convenience... P/s: It sound not as that good but when I use ASP.NET they provide something like that...and some how I miss them :D |
Right, so the main purpose would be so the errors show up in the MultiError list ? |
Also do you have a link to the docs for the ASP.NET version? Would be curious to see how theirs works. |
Yes, we can say the main purpose is "helping lazy one" 😄 |
I definitely don't want to invent some kind of microlanguage in struct tags for validation, so I think that's out. It seems to me that giving schema the ability to register some kind of callback validator to be called upon decode isn't much better than simply calling a validation function after decoding has been completed. I'm willing to be convinced otherwise, but closing this for now. |
Hi, first thank for your great toolkit!
I'm using gorilla/schema in my app and I hope it can help me with some simple validate.
For example, with s struct:
And then given a map of Validator
We can decode and check validate error easily.
Thanks
P/s: If you don't have time or maybe this request not suit to the pkg, I hope you can show me some tip to start it myself.
The text was updated successfully, but these errors were encountered: