I wanted to prevent a json filed from allowing null as a valid value for it. Tried using the keyword not, but no luck.
Want the below json to be validated as false, as the field stats as value as null.
{
"stats": "null"
}
please find my schema below:-
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://jsonschema.net#",
"type": "object",
"additionalProperties": false,
"maxProperties": 1,
"properties": {
"stats": {
"id": "http://jsonschema.net/stats#",
"type": "string",
"maxLength": 5,
"minLength": 2,
"additionalProperties": false,
"maxProperties": 1,
"not": {"type": "null"}
}
},
"required": [
"stats"
]
}
Though i gave "not": {"type": "null"}, it still validated successfully.