We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const schema = Joi.object({ a: Joi.number(), b: Joi.number(), c: Joi.number() .when('a', { is: 1, otherwise: Joi.number().min(1) }) .when('b', { is: 1, then: Joi.number().min(1) }) }) schema.validate({ a: 1, b: 1, c: 0 });
{ error: null, value: { a: 1, b: 1, c: 0 } }
An error with child "c" fails because ["c" must be larger than or equal to 1]
child "c" fails because ["c" must be larger than or equal to 1]
The text was updated successfully, but these errors were encountered:
Marsup
No branches or pull requests
Context
What are you trying to achieve or the steps to reproduce ?
Which result you had ?
{ error: null, value: { a: 1, b: 1, c: 0 } }
What did you expect ?
An error with
child "c" fails because ["c" must be larger than or equal to 1]
The text was updated successfully, but these errors were encountered: