【发布时间】:2019-06-10 21:58:24
【问题描述】:
当角色是“学生”时,parentemail 是必需的。否则它应该是空的。
当我提供parentemail 时,以下内容不起作用。
如何验证字段是否为空,如果不为空,则会发生错误。
parentemail: Joi.string().email().when("role", {
is: "student",
then: Joi.required(),
otherwise: Joi.empty(undefined)
}),
【问题讨论】:
标签: joi