What is the best way to do a conditional when in Joi?
I would like to do:
if (a === 'Value1' || b === 'Value1') {
// Check the length is less than 300
}
And have this so far...
{
a: Joi.string(),
b: Joi.string(),
c: Joi.string()
.when('a', {
is: Joi.valid('Value1'),
then: Joi.string().max(300),
})
.when('b', {
is: Joi.valid('Value1'),
then: Joi.string().max(300),
})
.label('C label')
}