minItems : Integer

minItems

Integer

An 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

A schema that constrains array instances to contain at least 3 items Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "minItems": 3
}
Valid An array value with more than 3 items is valid Instance
[ 1, 2, 3, 4 ]
Valid An array value with 3 items is valid Instance
[ 1, true, "hello" ]
Invalid An array value with less than 3 items is invalid Instance
[ false, "foo" ]
Valid A non-array value is valid Instance
"Hello World"