Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array validation does not comply with JSON Schema spec when items schema is specified #7

Closed
bugventure opened this issue Nov 11, 2014 · 0 comments
Labels
Milestone

Comments

@bugventure
Copy link
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant