多个Joivalidationtypes
我search了很多,但没有发现允许在Joi
多种typesvalidation
链接: https : //github.com/hapijs/joi
我想用这样的东西:
validate: { type: joi.or([ joi.string(), joi.array(), ]) };
尝试:
validate: { type: joi.alternatives().try(joi.string(), joi.array()) }
要么:
validate: { type: [joi.string(), joi.array()] }
请参阅: https : //github.com/hapijs/joi/blob/v10.1.0/API.md#alternatives