Open wackazong opened 1 year ago
Thanks!
So usually when doing the struct validation you stop at the first error. At least that is what I always do, no need to do further checks/work if we know it's not good.
I think from a user perspective it would be helpful to not get caught in a trial/error loop. Especially if each transaction has an implied cost (I am working on a blockchain project).
From what I can see it should be possible to offer both options?
But you have individual field validation which behave the same way and you can hack it with ValidationError::params
so I'm not too keen on that right now myself.
Let's see what other people think.
I agree with @wackazong here.
Concrete examples:
validation of API request data: An API should report all errors at once, instead of just a single error
validation of a configuration file before starting an application. As a user, I really want to see all the validation errors at once, instead of having to do a "fix one error, re-run the binary, fix the next error, re-run...
I think that makes sense to change for the next version.
@Keats do you mind if I do a PR for this feature?
Sure but make sure to do it on https://github.com/Keats/validator/pull/249 I'm also wondering in general whether there are better/simpler ways to represent errors than those enums/structs, if you have ideas
Any update on this feature?
Thanks for putting this library together. I find it very easy and intuitive.
One question: are there plans to return
ValidationErrors
from struct validation instead of a single error? I think this would make much more sense since there can be multiple validation problems when validating the whole struct, probably related to specific fields.