-
Notifications
You must be signed in to change notification settings - Fork 50
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
Incorrect error message returned on nested array rules #86
Comments
Hey, sorry for the late response, i think that you made an error using the validator, the test should be something like this: const {Validator,Rule } = require("@cesium133/forgjs");
const UserRule = new Rule({
type:"array",
of: new Rule({type:"int", oneOf:[1, 2, 3]})
}, "User ID does not exist");
const validator = new Validator({
users: UserRule,
});
validator.getErrors({users: [1, 5]}); |
Hey, if the array rule object on the
|
Sorry I misunderstood your problem, can you give me an example of both the error and the expected result, in the firs example you are testing it against an array witch doesn’t have a key ‘users’ |
Thank you for prompt reply. Here is how to reproduce the issue
The expected behaviour is to return "user role is not valid". The top most error message is returned when doing a nested validation of an object. |
Example
The text was updated successfully, but these errors were encountered: