-
Notifications
You must be signed in to change notification settings - Fork 775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'"" should not be empty' when using Each() #924
Comments
To clarify, the translations are not limited to
|
All the validation errors will report on the supplied value that failed validation. This is because the validator wouldn't know if you are referencing a variable, an array or an object field. The validator only knows that the given value has failed and this is what is reported in the most expressive way possible. The only way I can think of for you to produce a contextual error as you want would be to nest the validation rules so that you know which title validator failed for which specific language and then implement a custom In other words Hope this helps... |
With so many open issues, it's become hard to really know what's really important and what I have fixed already. I'm closing issues that are too old, and I'm not really looking at them all. If this is still relevant, please comment here and I will reopen this issue. Thanks for reporting! 🐼 |
Hi! I was trying out this library to validate some JSON, and I'm really impressed how feature-rich it is.
That being said, I'm getting some unclear error messages when I assert that an array has no empty values.
For example, I'm trying to validate the following code (snippet):
I have some custom validators, one for the values:
One for the language codes (keys):
And finally one to combine them:
Then I use them to validate an array like this:
I'd expect a message along the lines of:
However instead I get:
Which is confusing for our API clients (because in reality we have more properties than just
title
).Is there any way that I configure the
TitleValidator
in theEach
to use the parent validator name + the key?(Note that I'm using the actual classes and not the aliases because we want to re-use some of the rules across our codebase. For example, we have multiple document types with the
title
property.)The text was updated successfully, but these errors were encountered: