json-schema-spec icon indicating copy to clipboard operation
json-schema-spec copied to clipboard

prefixItems does not explicitly mention instances arrays shorter than the keyword value length

Open gregsdennis opened this issue 3 years ago • 2 comments

The prefixItems keyword section says this:

Validation succeeds if each element of the instance validates against the schema at the same position, if any. This keyword does not constrain the length of the array. If the array is longer than this keyword's value, this keyword validates only the prefix of matching length.

Note that it explicitly mentions if the instance array is longer but nothing about when it's shorter. It does say that no length constraints are imposed, but it feels odd that it would mention one without the other.

We do have a test for this as well.

gregsdennis avatar Jan 19 '22 05:01 gregsdennis

The wording does seem confusing. I'm not sure it's wrong, but just that I'm not sure means it should be clearer.

jdesrosiers avatar Jan 20 '22 04:01 jdesrosiers

Yeah, it's definitely not wrong.

gregsdennis avatar Jan 20 '22 04:01 gregsdennis