diff options
author | Julian Berman <Julian@GrayVines.com> | 2020-04-28 09:45:15 -0400 |
---|---|---|
committer | Julian Berman <Julian@GrayVines.com> | 2020-04-28 09:45:15 -0400 |
commit | 0dd4b1c2f4dc2ce3cf083bfa339a517993ec68d5 (patch) | |
tree | 0f00c8209f4f49b76f5c1f2bb7568a4402cf1863 /json | |
parent | 12a5756a1cb0112878036aff1efd7cec2944367b (diff) | |
parent | ef1a0784695ad7eef68b8aefe75dbf42add91f58 (diff) | |
download | jsonschema-0dd4b1c2f4dc2ce3cf083bfa339a517993ec68d5.tar.gz |
Merge commit 'ef1a0784695ad7eef68b8aefe75dbf42add91f58'
* commit 'ef1a0784695ad7eef68b8aefe75dbf42add91f58':
Squashed 'json/' changes from d17e1ba2..2576db4d
Diffstat (limited to 'json')
-rw-r--r-- | json/test-schema.json | 90 | ||||
-rw-r--r-- | json/tests/draft2019-09/optional/format/relative-json-pointer.json | 7 | ||||
-rw-r--r-- | json/tests/draft2019-09/pattern.json | 41 | ||||
-rw-r--r-- | json/tests/draft2019-09/patternProperties.json | 37 | ||||
-rw-r--r-- | json/tests/draft3/pattern.json | 41 | ||||
-rw-r--r-- | json/tests/draft3/patternProperties.json | 37 | ||||
-rw-r--r-- | json/tests/draft4/pattern.json | 41 | ||||
-rw-r--r-- | json/tests/draft4/patternProperties.json | 37 | ||||
-rw-r--r-- | json/tests/draft6/pattern.json | 41 | ||||
-rw-r--r-- | json/tests/draft6/patternProperties.json | 37 | ||||
-rw-r--r-- | json/tests/draft7/optional/format/relative-json-pointer.json | 7 | ||||
-rw-r--r-- | json/tests/draft7/pattern.json | 41 | ||||
-rw-r--r-- | json/tests/draft7/patternProperties.json | 37 |
13 files changed, 454 insertions, 40 deletions
diff --git a/json/test-schema.json b/json/test-schema.json index 670d280..8393720 100644 --- a/json/test-schema.json +++ b/json/test-schema.json @@ -1,59 +1,73 @@ { "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Schema for tests", + "type": "array", + "items": { + "type": "object", + "required": [ "description", "schema", "tests" ], + "properties": { + "id": { + "description": "Uniquely identifies a set of tests", + "type": "string", + "format": "uri" + }, + "description": { "type": "string" }, + "schema": {}, + "tests": { + "description": "A set of related tests all using the same schema", + "type": "array", + "items": { "$ref": "#/definitions/test" }, + "minItems": 1 + } + }, + "additionalProperties": false, + "minItems": 1 + }, "definitions": { "outputItem": { "type": "object", "properties": { - "valid": {"type": "boolean"}, - "keywordLocation": {"type": "string"}, + "valid": { "type": "boolean" }, + "keywordLocation": { "type": "string" }, "absoluteKeywordLocation": { "type": "string", "format": "uri" }, - "instanceLocation": {"type": "string"}, + "instanceLocation": { "type": "string" }, "annotations": { "type": "array", - "items": {"$ref": "#/definitions/outputItem"} + "items": { "$ref": "#/definitions/outputItem" } }, "errors": { "type": "array", - "items": {"$ref": "#/definitions/outputItem"} + "items": { "$ref": "#/definitions/outputItem" } } } - } - }, - "type": "array", - "items": { - "type": "object", - "required": ["description", "schema", "tests"], - "properties": { - "description": {"type": "string"}, - "schema": {}, - "tests": { - "type": "array", - "items": { + }, + "test": { + "description": "A single test", + "type": "object", + "required": [ "description", "data", "valid" ], + "properties": { + "id": { + "description": "Uniquely identifies a single test", + "type": "string", + "format": "uri" + }, + "description": { "type": "string" }, + "data": {}, + "valid": { "type": "boolean" }, + "output": { "type": "object", - "required": ["description", "data", "valid"], + "required": [ "basic", "detailed", "verbose" ], "properties": { - "description": {"type": "string"}, - "data": {}, - "valid": {"type": "boolean"}, - "output": { - "type": "object", - "properties": { - "basic": {"$ref": "#/definitions/outputItem"}, - "detailed": {"$ref": "#/definitions/outputItem"}, - "verbose": {"$ref": "#/definitions/outputItem"} - }, - "required": ["basic", "detailed", "verbose"] - } - }, - "additionalProperties": false - }, - "minItems": 1 - } - }, - "additionalProperties": false, - "minItems": 1 + "basic": { "$ref": "#/definitions/outputItem" }, + "detailed": { "$ref": "#/definitions/outputItem" }, + "verbose": { "$ref": "#/definitions/outputItem" } + } + } + }, + "additionalProperties": false + } } } diff --git a/json/tests/draft2019-09/optional/format/relative-json-pointer.json b/json/tests/draft2019-09/optional/format/relative-json-pointer.json index ceeb743..17816c9 100644 --- a/json/tests/draft2019-09/optional/format/relative-json-pointer.json +++ b/json/tests/draft2019-09/optional/format/relative-json-pointer.json @@ -9,7 +9,7 @@ "valid": true }, { - "description": "a valid downwards RJP", + "description": "a valid downwards RJP", "data": "0/foo/bar", "valid": true }, @@ -27,6 +27,11 @@ "description": "an invalid RJP that is a valid JSON Pointer", "data": "/foo/bar", "valid": false + }, + { + "description": "negative prefix", + "data": "-1/foo/bar", + "valid": false } ] } diff --git a/json/tests/draft2019-09/pattern.json b/json/tests/draft2019-09/pattern.json index 92db0f9..3c7e04c 100644 --- a/json/tests/draft2019-09/pattern.json +++ b/json/tests/draft2019-09/pattern.json @@ -55,5 +55,46 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { "pattern": "^🐲*$" }, + "tests": [ + { + "description": "matches empty", + "data": "", + "valid": true + }, + { + "description": "matches single", + "data": "🐲", + "valid": true + }, + { + "description": "matches two", + "data": "🐲🐲", + "valid": true + }, + { + "description": "doesn't match one", + "data": "🐉", + "valid": false + }, + { + "description": "doesn't match two", + "data": "🐉🐉", + "valid": false + }, + { + "description": "doesn't match one ASCII", + "data": "D", + "valid": false + }, + { + "description": "doesn't match two ASCII", + "data": "DD", + "valid": false + } + ] } ] diff --git a/json/tests/draft2019-09/patternProperties.json b/json/tests/draft2019-09/patternProperties.json index 1d04a16..290cfc4 100644 --- a/json/tests/draft2019-09/patternProperties.json +++ b/json/tests/draft2019-09/patternProperties.json @@ -147,5 +147,42 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { + "patternProperties": { + "^🐲*$": { + "type": "integer" + } + } + }, + "tests": [ + { + "description": "matches empty", + "data": { "": 1 }, + "valid": true + }, + { + "description": "matches single", + "data": { "🐲": 1 }, + "valid": true + }, + { + "description": "matches two", + "data": { "🐲🐲": 1 }, + "valid": true + }, + { + "description": "doesn't match one", + "data": { "🐲": "hello" }, + "valid": false + }, + { + "description": "doesn't match two", + "data": { "🐲🐲": "hello" }, + "valid": false + } + ] } ] diff --git a/json/tests/draft3/pattern.json b/json/tests/draft3/pattern.json index 92db0f9..3c7e04c 100644 --- a/json/tests/draft3/pattern.json +++ b/json/tests/draft3/pattern.json @@ -55,5 +55,46 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { "pattern": "^🐲*$" }, + "tests": [ + { + "description": "matches empty", + "data": "", + "valid": true + }, + { + "description": "matches single", + "data": "🐲", + "valid": true + }, + { + "description": "matches two", + "data": "🐲🐲", + "valid": true + }, + { + "description": "doesn't match one", + "data": "🐉", + "valid": false + }, + { + "description": "doesn't match two", + "data": "🐉🐉", + "valid": false + }, + { + "description": "doesn't match one ASCII", + "data": "D", + "valid": false + }, + { + "description": "doesn't match two ASCII", + "data": "DD", + "valid": false + } + ] } ] diff --git a/json/tests/draft3/patternProperties.json b/json/tests/draft3/patternProperties.json index 2ca9aae..3a39983 100644 --- a/json/tests/draft3/patternProperties.json +++ b/json/tests/draft3/patternProperties.json @@ -111,5 +111,42 @@ "valid": false } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { + "patternProperties": { + "^🐲*$": { + "type": "integer" + } + } + }, + "tests": [ + { + "description": "matches empty", + "data": { "": 1 }, + "valid": true + }, + { + "description": "matches single", + "data": { "🐲": 1 }, + "valid": true + }, + { + "description": "matches two", + "data": { "🐲🐲": 1 }, + "valid": true + }, + { + "description": "doesn't match one", + "data": { "🐲": "hello" }, + "valid": false + }, + { + "description": "doesn't match two", + "data": { "🐲🐲": "hello" }, + "valid": false + } + ] } ] diff --git a/json/tests/draft4/pattern.json b/json/tests/draft4/pattern.json index 92db0f9..3c7e04c 100644 --- a/json/tests/draft4/pattern.json +++ b/json/tests/draft4/pattern.json @@ -55,5 +55,46 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { "pattern": "^🐲*$" }, + "tests": [ + { + "description": "matches empty", + "data": "", + "valid": true + }, + { + "description": "matches single", + "data": "🐲", + "valid": true + }, + { + "description": "matches two", + "data": "🐲🐲", + "valid": true + }, + { + "description": "doesn't match one", + "data": "🐉", + "valid": false + }, + { + "description": "doesn't match two", + "data": "🐉🐉", + "valid": false + }, + { + "description": "doesn't match one ASCII", + "data": "D", + "valid": false + }, + { + "description": "doesn't match two ASCII", + "data": "DD", + "valid": false + } + ] } ] diff --git a/json/tests/draft4/patternProperties.json b/json/tests/draft4/patternProperties.json index 5f741df..bdda1d7 100644 --- a/json/tests/draft4/patternProperties.json +++ b/json/tests/draft4/patternProperties.json @@ -116,5 +116,42 @@ "valid": false } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { + "patternProperties": { + "^🐲*$": { + "type": "integer" + } + } + }, + "tests": [ + { + "description": "matches empty", + "data": { "": 1 }, + "valid": true + }, + { + "description": "matches single", + "data": { "🐲": 1 }, + "valid": true + }, + { + "description": "matches two", + "data": { "🐲🐲": 1 }, + "valid": true + }, + { + "description": "doesn't match one", + "data": { "🐲": "hello" }, + "valid": false + }, + { + "description": "doesn't match two", + "data": { "🐲🐲": "hello" }, + "valid": false + } + ] } ] diff --git a/json/tests/draft6/pattern.json b/json/tests/draft6/pattern.json index 92db0f9..3c7e04c 100644 --- a/json/tests/draft6/pattern.json +++ b/json/tests/draft6/pattern.json @@ -55,5 +55,46 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { "pattern": "^🐲*$" }, + "tests": [ + { + "description": "matches empty", + "data": "", + "valid": true + }, + { + "description": "matches single", + "data": "🐲", + "valid": true + }, + { + "description": "matches two", + "data": "🐲🐲", + "valid": true + }, + { + "description": "doesn't match one", + "data": "🐉", + "valid": false + }, + { + "description": "doesn't match two", + "data": "🐉🐉", + "valid": false + }, + { + "description": "doesn't match one ASCII", + "data": "D", + "valid": false + }, + { + "description": "doesn't match two ASCII", + "data": "DD", + "valid": false + } + ] } ] diff --git a/json/tests/draft6/patternProperties.json b/json/tests/draft6/patternProperties.json index 1d04a16..290cfc4 100644 --- a/json/tests/draft6/patternProperties.json +++ b/json/tests/draft6/patternProperties.json @@ -147,5 +147,42 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { + "patternProperties": { + "^🐲*$": { + "type": "integer" + } + } + }, + "tests": [ + { + "description": "matches empty", + "data": { "": 1 }, + "valid": true + }, + { + "description": "matches single", + "data": { "🐲": 1 }, + "valid": true + }, + { + "description": "matches two", + "data": { "🐲🐲": 1 }, + "valid": true + }, + { + "description": "doesn't match one", + "data": { "🐲": "hello" }, + "valid": false + }, + { + "description": "doesn't match two", + "data": { "🐲🐲": "hello" }, + "valid": false + } + ] } ] diff --git a/json/tests/draft7/optional/format/relative-json-pointer.json b/json/tests/draft7/optional/format/relative-json-pointer.json index ceeb743..17816c9 100644 --- a/json/tests/draft7/optional/format/relative-json-pointer.json +++ b/json/tests/draft7/optional/format/relative-json-pointer.json @@ -9,7 +9,7 @@ "valid": true }, { - "description": "a valid downwards RJP", + "description": "a valid downwards RJP", "data": "0/foo/bar", "valid": true }, @@ -27,6 +27,11 @@ "description": "an invalid RJP that is a valid JSON Pointer", "data": "/foo/bar", "valid": false + }, + { + "description": "negative prefix", + "data": "-1/foo/bar", + "valid": false } ] } diff --git a/json/tests/draft7/pattern.json b/json/tests/draft7/pattern.json index 92db0f9..3c7e04c 100644 --- a/json/tests/draft7/pattern.json +++ b/json/tests/draft7/pattern.json @@ -55,5 +55,46 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { "pattern": "^🐲*$" }, + "tests": [ + { + "description": "matches empty", + "data": "", + "valid": true + }, + { + "description": "matches single", + "data": "🐲", + "valid": true + }, + { + "description": "matches two", + "data": "🐲🐲", + "valid": true + }, + { + "description": "doesn't match one", + "data": "🐉", + "valid": false + }, + { + "description": "doesn't match two", + "data": "🐉🐉", + "valid": false + }, + { + "description": "doesn't match one ASCII", + "data": "D", + "valid": false + }, + { + "description": "doesn't match two ASCII", + "data": "DD", + "valid": false + } + ] } ] diff --git a/json/tests/draft7/patternProperties.json b/json/tests/draft7/patternProperties.json index 1d04a16..290cfc4 100644 --- a/json/tests/draft7/patternProperties.json +++ b/json/tests/draft7/patternProperties.json @@ -147,5 +147,42 @@ "valid": true } ] + }, + { + "description": "non-BMP, checks for proper surrogate pair handling for UTF-16", + "schema": { + "patternProperties": { + "^🐲*$": { + "type": "integer" + } + } + }, + "tests": [ + { + "description": "matches empty", + "data": { "": 1 }, + "valid": true + }, + { + "description": "matches single", + "data": { "🐲": 1 }, + "valid": true + }, + { + "description": "matches two", + "data": { "🐲🐲": 1 }, + "valid": true + }, + { + "description": "doesn't match one", + "data": { "🐲": "hello" }, + "valid": false + }, + { + "description": "doesn't match two", + "data": { "🐲🐲": "hello" }, + "valid": false + } + ] } ] |