📜  joi 嵌套模式 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:23.883000             🧑  作者: Mango

代码示例1
const schemaA = Joi.string()
const schemaB = Joi.object({ keyB1: schemaA, keyB2: Joi.number() })
const schemaC = Joi.object({
  keyC1: Joi.string(),
  keyC2: schemaB  
})

Joi.validate({ keyC1: 'joi', keyC2: { keyB1: 'rocks!', keyB2: 3 } }, schemaC)