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
{{<instance-pass `'unevaluatedItems' does not have any effect on instances other than an array`>}}
98
-
"John Doe"
99
-
{{</instance-pass>}}
100
-
101
-
* Here, no items are defined in the above schema. Consequently, all items in an array instance are considered unevaluated, and the `unevaluatedItems` subschema applies to them. Since the subschema here is a boolean true, an instance with unevaluated items, regardless of their value, is considered valid.
102
-
103
-
{{<schema `Schema with 'unevaluatedItems' set to boolean false`>}}
* For the first instance, the annotation result of `prefixItems` is 0, and the annotation result of `contains` is [ 1 ]. However, the item at 2nd index (i.e., `false`) remains unevaluated, so the `unevaluatedItems` subschema applies to it. This subschema fails (as any instance against a false schema is always invalid), leading to validation failure.
141
-
142
-
* For the second instance, the annotation result of `prefixItems` is 0, and the annotation result of contains is [ 1, 2 ]. No items remain unevaluated; hence, the instance is considered valid.
110
+
{{<instance-fail `An array value that contains a string property and other non-number items is invalid`>}}
111
+
[ "foo", "bar", "baz" ]
112
+
{{</instance-fail>}}
143
113
144
-
{{<schema `Schema with 'unevaluatedItems', 'prefixItems', and 'contains', with unevaluatedItems set to an object schema`>}}
{{<instance-fail `An array instance with unevaluated items that do not conform to the 'unevaluatedItems' subschema is invalid`>}}
173
-
[ "foo", 101, [ false ]]
174
-
{{</instance-fail>}}
175
-
176
-
* For the first instance, there are no unevaluated items.
177
-
178
-
* For the second instance, the item at 2nd index (i.e., `false`) remains unevaluated, and the `unevaluatedItems` subschema applies to it. This item conforms to this subschema, and hence the instance is valid.
179
-
180
-
{{<schema `Schema with 'unevaluatedItems', and 'allOf' keyword`>}}
126
+
{{<schema `A schema that constraints array instances to only allow a single string item using a helper`>}}
{{<instance-fail `An array instance with unevaluated items that do not conform to the 'unevaluatedItems' subschema is invalid`>}}
207
-
[ "foo", 101, [ false ]]
147
+
{{<instance-fail `An array value that contains a string item and other items is invalid`>}}
148
+
[ "foo", 2, 3]
208
149
{{</instance-fail>}}
209
150
210
-
For the above two instances, the annotation result of top level `prefixItems` is 0, and the annotation result of the nested `prefixItems` is 1. The `unevaluatedItems` recognizes the annotations from top level `prefixItems` as well as nested `prefixItems` (as it can see through adjacent and nested applicators as only the produced annotations matter, not the schema structure) and ensures that the item at index 2 remains unevaluated and its subschema applies to it.
211
-
212
-
* The first instance passes as it conforms to the unevaluated subschema.
213
-
* The second instance fails as it does not conform to the unevaluated subschema.
214
-
215
-
{{<schema `Schema with 'unevaluatedItems', and 'allOf' keyword`>}}
0 commit comments