How would I make an optional/required object based on another value?
I would like extra to be required if dessert is equal to Cheese. If it's set to cake extra should not be present.
{
dessert: Joi.string().valid('Cake', 'Cheese').required(),
extra: Joi.object({
grapes: Joi.string(),
wine: Joi.string(),
})
}