Context
- node version: 6.x
- joi version: 10.4.1
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
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
});
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]