minItems : Integer
minItems
IntegerAn array instance is valid if its size is greater than, or equal to, the value of this keyword.
Value | This keyword must be set to a zero or positive integer |
---|---|
Kind | Assertion |
Applies To | Array |
Base Dialect | 2020-12 |
Changed In | None |
Introduced In | Draft 1 |
Vocabulary | Validation |
Specification | https://json-schema.org/draft/2020-12/json-schema-validation.html#section-6.4.2 |
Metaschema | https://json-schema.org/draft/2020-12/meta/validation |
Official Tests | draft2020-12/minItems.json |
Default |
0
|
Annotation | None |
Affected By | None |
Affects | None |
Also See |
|
The minItems
keyword restricts array instances to consists of an inclusive
minimum numbers of items.
Remember that JSON Schema is a constraint-driven language.
Therefore, non-array instances successfully validate against this
keyword. If needed, make use of the type
keyword to constraint
the accepted type accordingly.
Examples
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minItems": 3
}
[ 1, 2, 3, 4 ]
[ 1, true, "hello" ]
[ false, "foo" ]
"Hello World"