I am using Joi for my validation schema.
I would like that at least one of theses values should be true.
a=true b=true //valid
a=true b=true //valid
a=false b=true //valid
a=false b=false //invalid
I tried this: but i get a dependency error..
Joi.object({
a: Joi.boolean().when('b', {
is: true,
then: Joi.optional(),
otherwise: Joi.required(),
},
b: Joi.boolean().when('a', {
is: true,
then: Joi.optional(),
otherwise: Joi.required(),
},
});
Thanks!