-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
undefined in the array with label returns wrong missing value message #1392
Comments
Confirmed the bug, there is probably some wrong logic happening on the manipulation of the |
Thanks for confirming this bug, I will try to have a look the source code and get back with queries if any. |
I think it should be ValidationError: child "location" fails because ["location" must not be a sparse array, "location" at position 0 fails because ["longitude" is required]] |
@Marsup firstly thanks for your excellent work. Would you please consider merging a PR if I fix this issue? |
@veera83372 I had a look at your PR and it's not the correct fix, the validation was the real problem, not the error building process. Thanks for trying though ! |
The new error you'll get might not strictly be what you'd expect in terms of wording but it's how it should always have been. |
@Marsup Thank you for your time and help. Will check the new fix. Is this version out at npm ? |
It should be yes. |
Context
What are you trying to achieve or the steps to reproduce ?
I am trying to validate a variable (array of length two) which is a location data, with lat long.
I want to validate the array such that
-90 < lat < 90
and-180 < long<180
also make sure that both the values are present.Location data is in GeoJSON hence data at 0 position should be longitude and latitude at pos 1. And subsequent rules should be applied for testing.
Describe your issue here, include schemas and inputs you are validating if needed.
Which result you had ?
What did you expect ?
observe the error message: "location does not contain [latitude]", should it rather not be "longitude" ?
because the first parameter is undefined, should not the output specify which of the input index has the error? (here in this case longitude because we are using label)?
Let me know if you think this is a bug (or if this is intended and I am using this feature wrongly) And if there is something i can do to fix it (would be happy to make a PR if needed)
Thank you for the time.
The text was updated successfully, but these errors were encountered: