asaskevich / govalidator

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

Add error support for custom validators #375

Open yamil-rivera opened 4 years ago

yamil-rivera commented 4 years ago

Currently, by rolling out our own validators using CustomTypeValidator interface, we cannot have a way to return a descriptive error for the validation that failed. Our only choice is to use the custom error message in the tag, but that one is really limited. Can the CustomTypeValidator interface be changed to return an error as well?

migueleliasweb commented 3 years ago

This is very important for complex validations that sometimes can't just have static error messages being returned from the struct. +1!

sergeyglazyrindev commented 3 years ago

+1. Oh, really, I added duplicated feature request. I can do that.

sergeyglazyrindev commented 3 years ago

Hello guys! I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back Link to my repo: create issue there and we'll discuss it.