@@ -1633,6 +1633,12 @@ results.
1633
1633
1634
1634
#### Keywords for Applying Subschemas to Arrays
1635
1635
1636
+ ##### Indexing Arrays {#array-index}
1637
+
1638
+ When working with arrays and indices, JSON Schema uses zero-based indexing. This
1639
+ aligns with both JSON's JavaScript heritage and its usage of JSON Pointer for
1640
+ references and annotations.
1641
+
1636
1642
##### ` prefixItems `
1637
1643
1638
1644
The value of ` prefixItems ` MUST be a non-empty array of valid JSON Schemas.
@@ -1657,20 +1663,20 @@ The value of `items` MUST be a valid JSON Schema.
1657
1663
This keyword ignores elements in the instance array equal to the number of
1658
1664
subschemas found in the ` prefixItems ` array in the same schema object, starting
1659
1665
from the beginning of the instance array. It then applies its subschema to
1660
- remaining instance elements. If ` prefixItems ` does not exist within the same
1661
- schema object, ` items ` applies its subschema to all instance array elements.
1666
+ remaining elements.
1667
+
1668
+ If ` prefixItems ` contains more subschemas than the number of elements in the
1669
+ instance array, ` items ` applies its subschema to no elements.
1670
+
1671
+ If ` prefixItems ` does not exist within the same schema object, ` items ` applies
1672
+ its subschema to all elements.
1662
1673
1663
1674
If the ` items ` subschema is applied to any positions within the instance array,
1664
1675
it produces an annotation result of boolean true, indicating that all remaining
1665
1676
array elements have been evaluated against this keyword's subschema.
1666
1677
1667
1678
Omitting this keyword has the same assertion behavior as an empty schema.
1668
1679
1669
- Implementations MAY choose to implement or optimize this keyword in another way
1670
- that produces the same effect, such as by directly checking for the presence and
1671
- size of a ` prefixItems ` array. Implementations that do not support annotation
1672
- collection MUST do so.
1673
-
1674
1680
The presence of this keyword affects the behavior of
1675
1681
[ ` unevaluatedItems ` ] ( #unevaluateditems ) .
1676
1682
@@ -1712,7 +1718,8 @@ The annotation result of this keyword is the set of instance property names
1712
1718
matched by at least one property under this keyword.
1713
1719
1714
1720
The presence of this keyword affects the behaviors of
1715
- [ ` additionalProperties ` (#additionalproperties) and [ ` unevaluatedProperties ` ] ( #unevaluatedproperties ) .
1721
+ [ ` additionalProperties ` (#additionalproperties) and
1722
+ [ ` unevaluatedProperties ` ] ( #unevaluatedproperties ) .
1716
1723
1717
1724
##### ` additionalProperties ` {#additionalproperties}
1718
1725
@@ -1789,12 +1796,12 @@ The minimum number of occurrences is provided by the `minContains` keyword
1789
1796
within the same schema object as ` contains ` . If ` minContains ` is absent, the
1790
1797
minimum number of occurrences MUST be 1.
1791
1798
1792
- This keyword produces an annotation value which is an array of the indices for
1793
- which this keyword validates successfully when applying its subschema, in
1794
- ascending order. The value MAY be a boolean ` true ` if the subschema validates
1795
- successfully when applied to every index of the instance. The annotation MUST be
1796
- present if the instance array to which this keyword's schema applies
1797
- is empty.
1799
+ This keyword produces an annotation value which is an array of the zero-based
1800
+ indices for which this keyword validates successfully when applying its
1801
+ subschema, in ascending order. The value MAY be a boolean ` true ` if the
1802
+ subschema validates successfully when applied to every index of the instance.
1803
+ The annotation MUST be present if the instance array to which this keyword's
1804
+ schema applies is empty.
1798
1805
1799
1806
The presence of this keyword affects the behavior of
1800
1807
[ ` unevaluatedItems ` ] ( #unevaluateditems ) .
0 commit comments