Empty key is not validated by "required" keyword #2077
Open
Description
What version of Ajv are you using? Does the issue happen if you use the latest version?
8.11.0
Ajv options object
Without options
JSON Schema
{
"$schema":"http://json-schema.org/draft-07/schema",
"type":"object",
"properties":{
"": { "type": "number" }
},
"required": [ "" ]
}
Sample data
{}
Your code
const ajv = new Ajv();
const validate = ajv.compile(schema);
console.log("Broken example",validate(data))
https://runkit.com/hosekp/630f1b9d59cb9b000b008aaf
Validation result, data AFTER validation, error messages
No errors
What results did you expect?
I expect an error about missing "" property
Are you going to resolve the issue?
I have found a workaround. If you use loopRequired=0 option, it is working.