You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/2019-09/applicator/additionalItems.markdown
+102Lines changed: 102 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,3 +37,105 @@ related:
37
37
- vocabulary: applicator
38
38
keyword: unevaluatedItems
39
39
---
40
+
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.
46
+
47
+
{{<common-pitfall>}}This keyword **only** has an effect when the sibling
48
+
[`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>}}
52
+
53
+
{{<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>}}
57
+
58
+
{{<constraint-warning `array`>}}
59
+
60
+
## Examples
61
+
62
+
{{<schema `A schema that constrains array instances to start with a boolean item followed by a number item, with only string items allowed beyond that`>}}
0 commit comments