Open badsyntax opened 11 years ago
This is old but I will give my thoughts, I think perhaps it should give one for each plugin, but not as strings, for those who want to rely on custom messages they would have to parse strings and that would be a hassle.
I'll love something like this:
{
date: {
required: 'This parameter is required.',
type: 'Invalid parameter data type, expected: Date'
}
}
Hi there. Thanks for the module, I've found it to be very useful.
I've noticed some inconstancies with how the errors are generated.
For example, lets say I have the following code:
Now if I run a check against a data object with no data, I get two validation errors:
If I run the check against the data object with one incorrect type, I only get one error:
I would expect the above check to return two errors.
It would be useful if all failed checks are returned in the errors object. It would also be useful if the errors were better formatted to allow me to reliably loop through them, something like this:
What do you think?