Why doesn't this work in my schema:
var schema = Joi.object().keys({
setting: Joi.alternatives().when('$auth.credentials.cond1', {
is: true,
then: Joi.number().integer().required().when('$auth.credentials.cond2', {
is: true,
then: Joi.invalid(100, 101)
}),
otherwise: Joi.forbidden()
})
});
When $auth.credentials.cond1 is true, and setting is not provided in the input object, there is no validation error when there should be because it is required.
Why doesn't this work in my schema:
When
$auth.credentials.cond1is true, andsettingis not provided in the input object, there is no validation error when there should be because it is required.