[英]Joi validation for the given schema
What will be the validation of the following schema using Joi validation?使用 Joi 验证对以下模式的验证是什么? How do we validate nested objects and arrays?
我们如何验证嵌套对象和 arrays?
const user = {
address: {
contactName: 'Sunny',
detailAddress: {
line1: 'Sector: 2/A',
line2: 'Q. No.: 3-018',
line3: 'Near Shopping Centre'
},
pin: 827001,
country: 'India'
},
cart: [
{
id: 'newId',
count: 2
}
]
};
you have to use Object.keys()
this link will help you https://stackoverflow.com/a/36741711/2429434你必须使用
Object.keys()
这个链接会帮助你https://stackoverflow.com/a/36741711/2429434
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.