Array validation does not comply with JSON Schema spec when items schema is specified
Closed this issue · 0 comments
bugventure commented
When validating arrays and an items
schema is specified in the form of array of schemas, validation fails if the validated array contains less items than specified by items
. This is not compliant with JSON Schema: items and additionalItems spec . In section 5.3.1.3. Example, the spec clearly indicates that arrays with fewer items than specified by the items
array in the schema are valid.
Example:
var schema = {
type: 'array',
items: [
{ type: 'string' },
{ type: 'integer' }
]
};
validator(schema).validate([]); // throws, in conflict with the JSON Schema spec