Maxitems - sgpinkus/json-schema GitHub Wiki

THIS WIKI IS OBSOLETE. PLEASE SEE THE NEW JSON-SCHEMA-ORG/JSON-SCHEMA-SPEC REPOSITORY.



Description

An array instance is valid with regards to this keyword if and only if its number of elements is less than, or equal to, this keyword's value.

Valid values

The value of maxItems MUST be an integer. This integer MUST be greater than, or equal to, 0.

Examples

Given this schema:

{
    "maxItems": 3
}

the following instances are valid:

  • [];
  • [ 1, 2, 3 ];

the following instances are invalid:

  • [ "too", "many", "elements", "here" ];
  • [ 1, 2, 3, 4, 5, null ].
⚠️ **GitHub.com Fallback** ⚠️