maxItems : Integer
maxItems
IntegerAn array instance is valid if its size is less than, or equal to, the value of this keyword.
| Value |
This keyword must be set to a zero or positive integer
Hint: Use the jsonschema metaschema and jsonschema lint commands to catch keywords set to invalid values
|
|---|---|
| Kind | Assertion |
| Applies To | Array |
| Base Dialect | Draft 3 |
| Changed In | None |
| Introduced In | Draft 1 |
| Vocabulary | Core |
| Specification | https://json-schema.org/draft-03/draft-zyp-json-schema-03.pdf#5.14 |
| Metaschema | http://json-schema.org/draft-03/schema# |
| Official Tests | draft3/maxItems.json |
| Default | None |
| Annotation | None |
| Affected By | None |
| Affects | None |
| Also See |
Examples
Schema with 'maxItems' keyword
Schema
{
"$schema": "http://json-schema.org/draft-03/schema#",
"type": "array",
"maxItems": 3,
"items": {
"type": "string"
}
}
Valid
An array instance with less than or equal to the maxItems value is valid
Instance
["learn", "json", "schema"]
Invalid
An array instance with greater than the maxItems value is invalid
Instance
["learn", "json", "schema", "draft3"]