I use Ajv to validate my JSON data. I cannot find a way to check an empty string as a key value. I tried to use a template, but it does not call the corresponding message.
Here is my diagram
{
"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']
}
I use minLength to verify that the value must contain at least one character. But it also allows empty space.
source
share