Constraining the elements, the size, and the contents of arrays
items — schema for every element
items is itself a schema. Every element of the array must match it. {"type": "array", "items": {"type": "string"}} means 'array of strings'.
prefixItems — tuple-style validation
Pass an array of schemas to prefixItems to validate position-by-position: position 0 against the first schema, position 1 against the second, etc. Use this for fixed-shape tuples ([latitude, longitude], [year, month, day]). Beyond the prefix, items applies (or set items: false to forbid extras).
Size & uniqueness
minItems,maxItems— count bounds.uniqueItems— booleans/strings/numbers easy; objects compared by deep equality.contains— at least one element must match this sub-schema.
Principle: homogeneous arrays use
items; tuple-shaped arrays ([latitude, longitude], [r, g, b, a]) use prefixItems. Don't reach for items with a oneOf when prefixItems will do — it's clearer at read-time and catches more position-specific errors.