commonjs-utils
commonjs-utils copied to clipboard
Item attribute doesn't validate properly
For example, take the following schema definition:
{ "type": "object", "properties": { "quizname": { "type": "string", "required" : true }, "scores": { "type": "object", "required" : true, "items": { "type": "integer", "required" : true, "minimum" : 0, "maximum" : 1 } } }, "additionalProperties" : false }
Then try to this with it, which should be invalid:
{
"quizname": "quiz1",
"scores": {"foobar":[0,1,1,1]}
}
This is invalid for a number of reasons, including: the instance value of scores is not a array, and the contents of the instance value of scores are not integers, they're objects (arrays).
I have noticed multiple other schemas containing "items" in which validation does not go as expected. I'm looking into the code to try to fix it, but in the meantime does anyone see anything wrong with my schema that would allow that bad json to get marked as valid?