Tengo el siguiente objeto Joi :
const Content = Joi .object({ type: Joi.valid('contentType1', 'contentType2') value: 'validate with that certain type' })¿Hay alguna forma de validar el valor del campo en función del valor del tipo de campo?
Lo conseguí haciendo esto:
const Content = Joi .object({ type: Joi.valid('contentType1', 'contentType2') value: Joi .when('type', { is: 'contentType1', then: Joi.valid('Yey') }) .when('type', { is: 'contentType2', then: Joi.valid('Yow') }) })