Tuple validation, required elements in tuple
bali182 opened this issue · 2 comments
bali182 commented
https://json-schema.org/understanding-json-schema/reference/array.html#tuple-validation
The example for tuple validation demonstrates it using this sample:
{
"type": "array",
"prefixItems": [
{ "type": "number" },
{ "type": "string" },
{ "enum": ["Street", "Avenue", "Boulevard"] },
{ "enum": ["NW", "NE", "SW", "SE"] }
]
}And then says the following input is valid:
[10, "Downing", "Street"]Since I don't see any distinguishing factor between the last schema item ({ "enum": ["NW", "NE", "SW", "SE"] }) and the rest, does this mean all the following are valid?
[1, "str"][1][]If so how would I express a schema identical to this, except it MUST havel all 4 items, meaning neither of them is optional?
Relequestual commented
You are correct.
You must use minItems: http://json-schema.org/understanding-json-schema/reference/array.html#length
bali182 commented
Understood, thanks!