-
-
Notifications
You must be signed in to change notification settings - Fork 616
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
Unexpected change in behaviour v6/v7 for .notEmpty() #1243
Comments
I'm guessing this is an unexpected regression from fixing #791. Basically, the new behaviour for standard validators is: if you have an array, then every item in the array should comply with the validator. I think that changing In the mean time, you can fix this by instead using the |
Describe the bug
We're using
.notEmpty()
to validate an incoming request body. After upgrading major version from 6 to 7, our unit tests started to fail. Turns out v7.notEmpty()
does not return a validation error for an empty array.I do not see this in the breaking changes, unless it's part of some of the other points described there
edit: after looking through the docs, it seems
.notEmpty()
should have been used for strings. However I think the changed behaviour is still unexpected?To Reproduce
Here you can see the different results:
Expected behavior
v6 and v7 to have similar behaviour
Current behavior
v7 does not return validation error for empty array
Environment:
The text was updated successfully, but these errors were encountered: