Hello. Anyone have any advice on how to validate a user struct with "password" and "encrypted_password" so that the password validation only runs if the encrypted one is set?
I think it does not work that way. The "problem" is that fields are validated independently. So even when you use the tagMap, synchronization would be pretty tricky. Furthermore, my thinking is that this is business logic and should belong to the handler(Func)/controller/service or however you have organized your application.
How do you access multiple validation errors?
Are you guys using Go also ? Just have 1 idea to validate encrypted_password that about the length
@LeVuVanThinh Why don't you validate the password the "old" way: on entering and again before you hash it (I sincerely hope you do not encrypt it).
is there any way to customise error messages using govalidator lib?
@twistedlog Basically, you use a tilde after the validator in the struct tag: valid:"required~Your custom error message on zero value,length(4|10)~Your custom error message for length constraint violation"
Howdy - I was wondering since it's been just about two months since the fix for #266 was added if a v10 release is in the works?
hi all, is there a way to validate that a slice is to be non empty?
looks like "required" already takes care of it!
hello, is it possible to validate a struct field against another field from the same struct?