我正在尝试验证以下内容,因此当“ l”为假时,“ xl”也必须为假。
xl: joi.object().keys({
enabled: joi.boolean().required(),
size: joi.number()
}).when('l.enabled', {
is: false,
then: 'xl.enabled needs to be false',
otherwise: joi.boolean(),
}),
l: joi.object().keys({
enabled: joi.boolean().required(),
size: joi.number()
}).when('m.enabled', {
is: false,
then: 'l.enabled needs to be false',
otherwise: joi.boolean(),
}),
m: ... continues on the same as above..
谢谢!