asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
6.05k stars 555 forks source link

Return from Custom validators (added through CustomTypeTagMap) error instead of bool #444

Open sergeyglazyrindev opened 3 years ago

sergeyglazyrindev commented 3 years ago

Feature Request

New Feature : yes RFC: no BC Break: no

Summary

Hello guys! I am writing some go project and I thought it would be better if we return from custom validators specific error, instead of boolean. That helps to use custom validators to validate different possible wrong cases. Basically, in my project I wanted to create custom validator to validate username against few rules, instead of writing long struct field annotations. But seems like it's not possible right now. I can do that if community likes this idea.