diff --git a/tests/draft-next/unevaluatedItems.json b/tests/draft-next/unevaluatedItems.json index 9e0faef5..ce5d0438 100644 --- a/tests/draft-next/unevaluatedItems.json +++ b/tests/draft-next/unevaluatedItems.json @@ -99,7 +99,7 @@ ] }, { - "description": "unevaluatedItems with items", + "description": "unevaluatedItems with items and prefixItems", "schema": { "$schema": "https://json-schema.org/draft/next/schema", "prefixItems": [ @@ -116,6 +116,27 @@ } ] }, + { + "description": "unevaluatedItems with items", + "schema": { + "$schema": "https://json-schema.org/draft/next/schema", + "items": {"type": "number"}, + "unevaluatedItems": {"type": "string"} + }, + "tests": [ + { + "description": "valid under items", + "comment": "no elements are considered by unevaluatedItems", + "data": [5, 6, 7, 8], + "valid": true + }, + { + "description": "invalid under items", + "data": ["foo", "bar", "baz"], + "valid": false + } + ] + }, { "description": "unevaluatedItems with nested tuple", "schema": { diff --git a/tests/draft2019-09/unevaluatedItems.json b/tests/draft2019-09/unevaluatedItems.json index 55d33e21..a0b1f338 100644 --- a/tests/draft2019-09/unevaluatedItems.json +++ b/tests/draft2019-09/unevaluatedItems.json @@ -99,7 +99,7 @@ ] }, { - "description": "unevaluatedItems with additionalItems", + "description": "unevaluatedItems with items and additionalItems", "schema": { "$schema": "https://json-schema.org/draft/2019-09/schema", "items": [ @@ -116,6 +116,48 @@ } ] }, + { + "description": "unevaluatedItems with ignored additionalItems", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "additionalItems": {"type": "number"}, + "unevaluatedItems": {"type": "string"} + }, + "tests": [ + { + "description": "invalid under unevaluatedItems", + "comment": "additionalItems is entirely ignored when items isn't present, so all elements need to be valid against the unevaluatedItems schema", + "data": ["foo", 1], + "valid": false + }, + { + "description": "all valid under unevaluatedItems", + "data": ["foo", "bar", "baz"], + "valid": true + } + ] + }, + { + "description": "unevaluatedItems with ignored applicator additionalItems", + "schema": { + "$schema": "https://json-schema.org/draft/2019-09/schema", + "allOf": [ { "additionalItems": { "type": "number" } } ], + "unevaluatedItems": {"type": "string"} + }, + "tests": [ + { + "description": "invalid under unevaluatedItems", + "comment": "additionalItems is entirely ignored when items isn't present, so all elements need to be valid against the unevaluatedItems schema", + "data": ["foo", 1], + "valid": false + }, + { + "description": "all valid under unevaluatedItems", + "data": ["foo", "bar", "baz"], + "valid": true + } + ] + }, { "description": "unevaluatedItems with nested tuple", "schema": { diff --git a/tests/draft2020-12/unevaluatedItems.json b/tests/draft2020-12/unevaluatedItems.json index 4e9dc721..2b816af9 100644 --- a/tests/draft2020-12/unevaluatedItems.json +++ b/tests/draft2020-12/unevaluatedItems.json @@ -99,7 +99,7 @@ ] }, { - "description": "unevaluatedItems with items", + "description": "unevaluatedItems with items and prefixItems", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "prefixItems": [ @@ -116,6 +116,27 @@ } ] }, + { + "description": "unevaluatedItems with items", + "schema": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "items": {"type": "number"}, + "unevaluatedItems": {"type": "string"} + }, + "tests": [ + { + "description": "valid under items", + "comment": "no elements are considered by unevaluatedItems", + "data": [5, 6, 7, 8], + "valid": true + }, + { + "description": "invalid under items", + "data": ["foo", "bar", "baz"], + "valid": false + } + ] + }, { "description": "unevaluatedItems with nested tuple", "schema": {