@@ -38,22 +38,24 @@ related:
3838 keyword : unevaluatedItems
3939---
4040
41- The ` additionalItems ` keyword restricts array instance items not described by
42- the _ sibling_ [ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) keyword (when
43- [ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) is in array form), to
44- validate against the given subschema. Whether this keyword was evaluated
45- against any item of the array instance is reported using annotations.
41+ The [ ` additionalItems ` ] ({{< ref "2019-09/applicator/additionalitems" >}})
42+ keyword restricts array instance items not described by the _ sibling_
43+ [ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) keyword (when [ ` items ` ] ({{<
44+ ref "2019-09/applicator/items" >}}) is in array form), to validate against the
45+ given subschema. Whether this keyword was evaluated against any item of the
46+ array instance is reported using annotations.
4647
4748{{<common-pitfall >}}This keyword ** only** has an effect when the sibling
4849[ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) keyword is set to an array of
49- schemas. If [ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) is not present or is set to a schema (not an array),
50- [ ` additionalItems ` ] ({{< ref "2019-09/applicator/additionalitems" >}}) has no effect and is ignored. This is a common source of
51- confusion .{{</common-pitfall >}}
50+ schemas. If [ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) is not present or
51+ is set to a schema (not an array of schemas), [ ` additionalItems ` ] ({{< ref
52+ "2019-09/applicator/additionalitems" >}}) has no effect and is ignored .{{</common-pitfall >}}
5253
5354{{<common-pitfall >}}This keyword does not prevent an array instance from being
54- empty or having fewer items than the [ ` items ` ] ({{< ref "2019-09/applicator/items" >}}) array. If needed, use the
55- [ ` minItems ` ] ({{< ref "2019-09/validation/minitems" >}}) to assert on the minimum
56- bounds of the array.{{</common-pitfall >}}
55+ empty or having fewer items than the [ ` items ` ] ({{< ref
56+ "2019-09/applicator/items" >}}) array. If needed, use the [ ` minItems ` ] ({{< ref
57+ "2019-09/validation/minitems" >}}) keyword to assert on the minimum bounds of
58+ the array.{{</common-pitfall >}}
5759
5860{{<constraint-warning ` array ` >}}
5961
@@ -116,7 +118,7 @@ bounds of the array.{{</common-pitfall>}}
116118[ false, 35, "foo" ]
117119{{</instance-fail >}}
118120
119- {{<schema ` A schema that demonstrates when this keyword has no effect ` >}}
121+ {{<schema ` A schema that describes open items and additional items leads to the additional items schema being ignored ` >}}
120122{
121123 "$schema": "https://json-schema.org/draft/2019-09/schema ",
122124 "items": { "type": "number" },
@@ -139,3 +141,18 @@ bounds of the array.{{</common-pitfall>}}
139141{{<instance-annotation >}}
140142{ "keyword": "/items", "instance": "", "value": true }
141143{{</instance-annotation >}}
144+
145+ {{<schema ` A schema with only additional items definitions leads to the additional items schema being ignored ` >}}
146+ {
147+ "$schema": "https://json-schema.org/draft/2019-09/schema ",
148+ "additionalItems": { "type": "string" }
149+ }
150+ {{</schema >}}
151+
152+ {{<instance-pass ` Any array is valid ` >}}
153+ [ 1, 2, 3 ]
154+ {{</instance-pass >}}
155+
156+ {{<instance-pass ` A non-array value is valid ` >}}
157+ "Hello World"
158+ {{</instance-pass >}}
0 commit comments