diff options
-rw-r--r-- | tests/draft3/minimum.json | 31 | ||||
-rw-r--r-- | tests/draft4/dependencies.json | 71 | ||||
-rw-r--r-- | tests/draft4/enum.json | 23 | ||||
-rw-r--r-- | tests/draft4/minimum.json | 31 | ||||
-rw-r--r-- | tests/draft4/properties.json | 39 | ||||
-rw-r--r-- | tests/draft4/ref.json | 27 | ||||
-rw-r--r-- | tests/draft4/required.json | 35 | ||||
-rw-r--r-- | tests/draft6/dependencies.json | 71 | ||||
-rw-r--r-- | tests/draft6/enum.json | 23 | ||||
-rw-r--r-- | tests/draft6/minimum.json | 31 | ||||
-rw-r--r-- | tests/draft6/properties.json | 39 | ||||
-rw-r--r-- | tests/draft6/ref.json | 27 | ||||
-rw-r--r-- | tests/draft6/required.json | 35 | ||||
-rw-r--r-- | tests/draft7/dependencies.json | 71 | ||||
-rw-r--r-- | tests/draft7/enum.json | 23 | ||||
-rw-r--r-- | tests/draft7/minimum.json | 31 | ||||
-rw-r--r-- | tests/draft7/properties.json | 39 | ||||
-rw-r--r-- | tests/draft7/ref.json | 27 | ||||
-rw-r--r-- | tests/draft7/required.json | 35 |
19 files changed, 709 insertions, 0 deletions
diff --git a/tests/draft3/minimum.json b/tests/draft3/minimum.json index d5bf000..5ac9fee 100644 --- a/tests/draft3/minimum.json +++ b/tests/draft3/minimum.json @@ -38,5 +38,36 @@ "valid": false } ] + }, + { + "description": "minimum validation with signed integer", + "schema": {"minimum": -2}, + "tests": [ + { + "description": "negative above the minimum is valid", + "data": -1, + "valid": true + }, + { + "description": "positive above the minimum is valid", + "data": 0, + "valid": true + }, + { + "description": "boundary point is valid", + "data": -2, + "valid": true + }, + { + "description": "below the minimum is invalid", + "data": -3, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] } ] diff --git a/tests/draft4/dependencies.json b/tests/draft4/dependencies.json index 38effa1..51eeddf 100644 --- a/tests/draft4/dependencies.json +++ b/tests/draft4/dependencies.json @@ -119,5 +119,76 @@ "valid": false } ] + }, + { + "description": "dependencies with escaped characters", + "schema": { + "dependencies": { + "foo\nbar": ["foo\rbar"], + "foo\tbar": { + "minProperties": 4 + }, + "foo'bar": {"required": ["foo\"bar"]}, + "foo\"bar": ["foo'bar"] + } + }, + "tests": [ + { + "description": "valid object 1", + "data": { + "foo\nbar": 1, + "foo\rbar": 2 + }, + "valid": true + }, + { + "description": "valid object 2", + "data": { + "foo\tbar": 1, + "a": 2, + "b": 3, + "c": 4 + }, + "valid": true + }, + { + "description": "valid object 3", + "data": { + "foo'bar": 1, + "foo\"bar": 2 + }, + "valid": true + }, + { + "description": "invalid object 1", + "data": { + "foo\nbar": 1, + "foo": 2 + }, + "valid": false + }, + { + "description": "invalid object 2", + "data": { + "foo\tbar": 1, + "a": 2 + }, + "valid": false + }, + { + "description": "invalid object 3", + "data": { + "foo'bar": 1 + }, + "valid": false + }, + { + "description": "invalid object 4", + "data": { + "foo\"bar": 2 + }, + "valid": false + } + ] } ] diff --git a/tests/draft4/enum.json b/tests/draft4/enum.json index 8fb9d7a..04a92a4 100644 --- a/tests/draft4/enum.json +++ b/tests/draft4/enum.json @@ -68,5 +68,28 @@ "valid": false } ] + }, + { + "description": "enum with escaped characters", + "schema": { + "enum": ["foo\nbar", "foo\rbar"] + }, + "tests": [ + { + "description": "member 1 is valid", + "data": "foo\nbar", + "valid": true + }, + { + "description": "member 2 is valid", + "data": "foo\rbar", + "valid": true + }, + { + "description": "another string is invalid", + "data": "abc", + "valid": false + } + ] } ] diff --git a/tests/draft4/minimum.json b/tests/draft4/minimum.json index 98f08d5..6becf2a 100644 --- a/tests/draft4/minimum.json +++ b/tests/draft4/minimum.json @@ -69,5 +69,36 @@ "valid": false } ] + }, + { + "description": "minimum validation with signed integer", + "schema": {"minimum": -2}, + "tests": [ + { + "description": "negative above the minimum is valid", + "data": -1, + "valid": true + }, + { + "description": "positive above the minimum is valid", + "data": 0, + "valid": true + }, + { + "description": "boundary point is valid", + "data": -2, + "valid": true + }, + { + "description": "below the minimum is invalid", + "data": -3, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] } ] diff --git a/tests/draft4/properties.json b/tests/draft4/properties.json index a830c67..688527b 100644 --- a/tests/draft4/properties.json +++ b/tests/draft4/properties.json @@ -93,5 +93,44 @@ "valid": false } ] + }, + { + "description": "properties with escaped characters", + "schema": { + "properties": { + "foo\nbar": {"type": "number"}, + "foo\"bar": {"type": "number"}, + "foo\\bar": {"type": "number"}, + "foo\rbar": {"type": "number"}, + "foo\tbar": {"type": "number"}, + "foo\fbar": {"type": "number"} + } + }, + "tests": [ + { + "description": "object with all numbers is valid", + "data": { + "foo\nbar": 1, + "foo\"bar": 1, + "foo\\bar": 1, + "foo\rbar": 1, + "foo\tbar": 1, + "foo\fbar": 1 + }, + "valid": true + }, + { + "description": "object with strings is invalid", + "data": { + "foo\nbar": "1", + "foo\"bar": "1", + "foo\\bar": "1", + "foo\rbar": "1", + "foo\tbar": "1", + "foo\fbar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft4/ref.json b/tests/draft4/ref.json index 52cf50a..1541caf 100644 --- a/tests/draft4/ref.json +++ b/tests/draft4/ref.json @@ -296,5 +296,32 @@ "valid": false } ] + }, + { + "description": "refs with quote", + "schema": { + "properties": { + "foo\"bar": {"$ref": "#/definitions/foo\"bar"} + }, + "definitions": { + "foo\"bar": {"type": "number"} + } + }, + "tests": [ + { + "description": "object with numbers is valid", + "data": { + "foo\"bar": 1 + }, + "valid": true + }, + { + "description": "object with strings is invalid", + "data": { + "foo\"bar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft4/required.json b/tests/draft4/required.json index 1e2a4f0..9b05318 100644 --- a/tests/draft4/required.json +++ b/tests/draft4/required.json @@ -50,5 +50,40 @@ "valid": true } ] + }, + { + "description": "required with escaped characters", + "schema": { + "required": [ + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\fbar" + ] + }, + "tests": [ + { + "description": "object with all properties present is valid", + "data": { + "foo\nbar": 1, + "foo\"bar": 1, + "foo\\bar": 1, + "foo\rbar": 1, + "foo\tbar": 1, + "foo\fbar": 1 + }, + "valid": true + }, + { + "description": "object with some properties missing is invalid", + "data": { + "foo\nbar": "1", + "foo\"bar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft6/dependencies.json b/tests/draft6/dependencies.json index 5af1894..8dd78aa 100644 --- a/tests/draft6/dependencies.json +++ b/tests/draft6/dependencies.json @@ -193,5 +193,76 @@ "valid": true } ] + }, + { + "description": "dependencies with escaped characters", + "schema": { + "dependencies": { + "foo\nbar": ["foo\rbar"], + "foo\tbar": { + "minProperties": 4 + }, + "foo'bar": {"required": ["foo\"bar"]}, + "foo\"bar": ["foo'bar"] + } + }, + "tests": [ + { + "description": "valid object 1", + "data": { + "foo\nbar": 1, + "foo\rbar": 2 + }, + "valid": true + }, + { + "description": "valid object 2", + "data": { + "foo\tbar": 1, + "a": 2, + "b": 3, + "c": 4 + }, + "valid": true + }, + { + "description": "valid object 3", + "data": { + "foo'bar": 1, + "foo\"bar": 2 + }, + "valid": true + }, + { + "description": "invalid object 1", + "data": { + "foo\nbar": 1, + "foo": 2 + }, + "valid": false + }, + { + "description": "invalid object 2", + "data": { + "foo\tbar": 1, + "a": 2 + }, + "valid": false + }, + { + "description": "invalid object 3", + "data": { + "foo'bar": 1 + }, + "valid": false + }, + { + "description": "invalid object 4", + "data": { + "foo\"bar": 2 + }, + "valid": false + } + ] } ] diff --git a/tests/draft6/enum.json b/tests/draft6/enum.json index 8fb9d7a..04a92a4 100644 --- a/tests/draft6/enum.json +++ b/tests/draft6/enum.json @@ -68,5 +68,28 @@ "valid": false } ] + }, + { + "description": "enum with escaped characters", + "schema": { + "enum": ["foo\nbar", "foo\rbar"] + }, + "tests": [ + { + "description": "member 1 is valid", + "data": "foo\nbar", + "valid": true + }, + { + "description": "member 2 is valid", + "data": "foo\rbar", + "valid": true + }, + { + "description": "another string is invalid", + "data": "abc", + "valid": false + } + ] } ] diff --git a/tests/draft6/minimum.json b/tests/draft6/minimum.json index bd1e95b..2a9c42b 100644 --- a/tests/draft6/minimum.json +++ b/tests/draft6/minimum.json @@ -24,5 +24,36 @@ "valid": true } ] + }, + { + "description": "minimum validation with signed integer", + "schema": {"minimum": -2}, + "tests": [ + { + "description": "negative above the minimum is valid", + "data": -1, + "valid": true + }, + { + "description": "positive above the minimum is valid", + "data": 0, + "valid": true + }, + { + "description": "boundary point is valid", + "data": -2, + "valid": true + }, + { + "description": "below the minimum is invalid", + "data": -3, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] } ] diff --git a/tests/draft6/properties.json b/tests/draft6/properties.json index c8ad719..b86c181 100644 --- a/tests/draft6/properties.json +++ b/tests/draft6/properties.json @@ -124,5 +124,44 @@ "valid": false } ] + }, + { + "description": "properties with escaped characters", + "schema": { + "properties": { + "foo\nbar": {"type": "number"}, + "foo\"bar": {"type": "number"}, + "foo\\bar": {"type": "number"}, + "foo\rbar": {"type": "number"}, + "foo\tbar": {"type": "number"}, + "foo\fbar": {"type": "number"} + } + }, + "tests": [ + { + "description": "object with all numbers is valid", + "data": { + "foo\nbar": 1, + "foo\"bar": 1, + "foo\\bar": 1, + "foo\rbar": 1, + "foo\tbar": 1, + "foo\fbar": 1 + }, + "valid": true + }, + { + "description": "object with strings is invalid", + "data": { + "foo\nbar": "1", + "foo\"bar": "1", + "foo\\bar": "1", + "foo\rbar": "1", + "foo\tbar": "1", + "foo\fbar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft6/ref.json b/tests/draft6/ref.json index 5b58964..1ca3c79 100644 --- a/tests/draft6/ref.json +++ b/tests/draft6/ref.json @@ -328,5 +328,32 @@ "valid": false } ] + }, + { + "description": "refs with quote", + "schema": { + "properties": { + "foo\"bar": {"$ref": "#/definitions/foo\"bar"} + }, + "definitions": { + "foo\"bar": {"type": "number"} + } + }, + "tests": [ + { + "description": "object with numbers is valid", + "data": { + "foo\"bar": 1 + }, + "valid": true + }, + { + "description": "object with strings is invalid", + "data": { + "foo\"bar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft6/required.json b/tests/draft6/required.json index bd96907..abf18f3 100644 --- a/tests/draft6/required.json +++ b/tests/draft6/required.json @@ -66,5 +66,40 @@ "valid": true } ] + }, + { + "description": "required with escaped characters", + "schema": { + "required": [ + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\fbar" + ] + }, + "tests": [ + { + "description": "object with all properties present is valid", + "data": { + "foo\nbar": 1, + "foo\"bar": 1, + "foo\\bar": 1, + "foo\rbar": 1, + "foo\tbar": 1, + "foo\fbar": 1 + }, + "valid": true + }, + { + "description": "object with some properties missing is invalid", + "data": { + "foo\nbar": "1", + "foo\"bar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft7/dependencies.json b/tests/draft7/dependencies.json index 5af1894..8dd78aa 100644 --- a/tests/draft7/dependencies.json +++ b/tests/draft7/dependencies.json @@ -193,5 +193,76 @@ "valid": true } ] + }, + { + "description": "dependencies with escaped characters", + "schema": { + "dependencies": { + "foo\nbar": ["foo\rbar"], + "foo\tbar": { + "minProperties": 4 + }, + "foo'bar": {"required": ["foo\"bar"]}, + "foo\"bar": ["foo'bar"] + } + }, + "tests": [ + { + "description": "valid object 1", + "data": { + "foo\nbar": 1, + "foo\rbar": 2 + }, + "valid": true + }, + { + "description": "valid object 2", + "data": { + "foo\tbar": 1, + "a": 2, + "b": 3, + "c": 4 + }, + "valid": true + }, + { + "description": "valid object 3", + "data": { + "foo'bar": 1, + "foo\"bar": 2 + }, + "valid": true + }, + { + "description": "invalid object 1", + "data": { + "foo\nbar": 1, + "foo": 2 + }, + "valid": false + }, + { + "description": "invalid object 2", + "data": { + "foo\tbar": 1, + "a": 2 + }, + "valid": false + }, + { + "description": "invalid object 3", + "data": { + "foo'bar": 1 + }, + "valid": false + }, + { + "description": "invalid object 4", + "data": { + "foo\"bar": 2 + }, + "valid": false + } + ] } ] diff --git a/tests/draft7/enum.json b/tests/draft7/enum.json index 8fb9d7a..04a92a4 100644 --- a/tests/draft7/enum.json +++ b/tests/draft7/enum.json @@ -68,5 +68,28 @@ "valid": false } ] + }, + { + "description": "enum with escaped characters", + "schema": { + "enum": ["foo\nbar", "foo\rbar"] + }, + "tests": [ + { + "description": "member 1 is valid", + "data": "foo\nbar", + "valid": true + }, + { + "description": "member 2 is valid", + "data": "foo\rbar", + "valid": true + }, + { + "description": "another string is invalid", + "data": "abc", + "valid": false + } + ] } ] diff --git a/tests/draft7/minimum.json b/tests/draft7/minimum.json index bd1e95b..2a9c42b 100644 --- a/tests/draft7/minimum.json +++ b/tests/draft7/minimum.json @@ -24,5 +24,36 @@ "valid": true } ] + }, + { + "description": "minimum validation with signed integer", + "schema": {"minimum": -2}, + "tests": [ + { + "description": "negative above the minimum is valid", + "data": -1, + "valid": true + }, + { + "description": "positive above the minimum is valid", + "data": 0, + "valid": true + }, + { + "description": "boundary point is valid", + "data": -2, + "valid": true + }, + { + "description": "below the minimum is invalid", + "data": -3, + "valid": false + }, + { + "description": "ignores non-numbers", + "data": "x", + "valid": true + } + ] } ] diff --git a/tests/draft7/properties.json b/tests/draft7/properties.json index c8ad719..b86c181 100644 --- a/tests/draft7/properties.json +++ b/tests/draft7/properties.json @@ -124,5 +124,44 @@ "valid": false } ] + }, + { + "description": "properties with escaped characters", + "schema": { + "properties": { + "foo\nbar": {"type": "number"}, + "foo\"bar": {"type": "number"}, + "foo\\bar": {"type": "number"}, + "foo\rbar": {"type": "number"}, + "foo\tbar": {"type": "number"}, + "foo\fbar": {"type": "number"} + } + }, + "tests": [ + { + "description": "object with all numbers is valid", + "data": { + "foo\nbar": 1, + "foo\"bar": 1, + "foo\\bar": 1, + "foo\rbar": 1, + "foo\tbar": 1, + "foo\fbar": 1 + }, + "valid": true + }, + { + "description": "object with strings is invalid", + "data": { + "foo\nbar": "1", + "foo\"bar": "1", + "foo\\bar": "1", + "foo\rbar": "1", + "foo\tbar": "1", + "foo\fbar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft7/ref.json b/tests/draft7/ref.json index 7579507..fecfe7e 100644 --- a/tests/draft7/ref.json +++ b/tests/draft7/ref.json @@ -328,5 +328,32 @@ "valid": false } ] + }, + { + "description": "refs with quote", + "schema": { + "properties": { + "foo\"bar": {"$ref": "#/definitions/foo\"bar"} + }, + "definitions": { + "foo\"bar": {"type": "number"} + } + }, + "tests": [ + { + "description": "object with numbers is valid", + "data": { + "foo\"bar": 1 + }, + "valid": true + }, + { + "description": "object with strings is invalid", + "data": { + "foo\"bar": "1" + }, + "valid": false + } + ] } ] diff --git a/tests/draft7/required.json b/tests/draft7/required.json index bd96907..abf18f3 100644 --- a/tests/draft7/required.json +++ b/tests/draft7/required.json @@ -66,5 +66,40 @@ "valid": true } ] + }, + { + "description": "required with escaped characters", + "schema": { + "required": [ + "foo\nbar", + "foo\"bar", + "foo\\bar", + "foo\rbar", + "foo\tbar", + "foo\fbar" + ] + }, + "tests": [ + { + "description": "object with all properties present is valid", + "data": { + "foo\nbar": 1, + "foo\"bar": 1, + "foo\\bar": 1, + "foo\rbar": 1, + "foo\tbar": 1, + "foo\fbar": 1 + }, + "valid": true + }, + { + "description": "object with some properties missing is invalid", + "data": { + "foo\nbar": "1", + "foo\"bar": "1" + }, + "valid": false + } + ] } ] |