我正在使用Ajv验证我的JSON数据。我无法找到验证空字符串作为键的值的方法。我尝试使用模式,但它不会抛出适当的消息。使用AJV在json模式中验证空值使用AJV
这里是我的架构
{
"type": "object",
"properties": {
"user_name": { "type": "string" , "minLength": 1},
"user_email": { "type": "string" , "minLength": 1},
"user_contact": { "type": "string" , "minLength": 1}
},
"required": [ "user_name", 'user_email', 'user_contact']
}
我使用的minLength检查值应包含至少一个字符。但它也允许空的空间。