Skip to content

Commit

Permalink
update JSON-Schema-Test-Suite to 2.0.0-175-g7ba95f3
Browse files Browse the repository at this point in the history
  • Loading branch information
pboettch committed May 15, 2020
1 parent 8125a3e commit be1792d
Show file tree
Hide file tree
Showing 22 changed files with 1,383 additions and 37 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "integer"
}
}
2 changes: 1 addition & 1 deletion test/JSON-Schema-Test-Suite/remotes/integer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"type": "integer"
}
}
15 changes: 15 additions & 0 deletions test/JSON-Schema-Test-Suite/remotes/name-defs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$defs": {
"orNull": {
"anyOf": [
{
"type": "null"
},
{
"$ref": "#"
}
]
}
},
"type": "string"
}
8 changes: 6 additions & 2 deletions test/JSON-Schema-Test-Suite/remotes/name.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
"definitions": {
"orNull": {
"anyOf": [
{"type": "null"},
{"$ref": "#"}
{
"type": "null"
},
{
"$ref": "#"
}
]
}
},
Expand Down
10 changes: 10 additions & 0 deletions test/JSON-Schema-Test-Suite/remotes/subSchemas-defs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
4 changes: 2 additions & 2 deletions test/JSON-Schema-Test-Suite/remotes/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"integer": {
"type": "integer"
},
},
"refToInteger": {
"$ref": "#/integer"
}
}
}
26 changes: 26 additions & 0 deletions test/JSON-Schema-Test-Suite/tests/draft7/allOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,5 +214,31 @@
"valid": false
}
]
},
{
"description": "nested allOf, to check validation semantics",
"schema": {
"allOf": [
{
"allOf": [
{
"type": "null"
}
]
}
]
},
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false
}
]
}
]
26 changes: 26 additions & 0 deletions test/JSON-Schema-Test-Suite/tests/draft7/anyOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,32 @@
}
]
},
{
"description": "nested anyOf, to check validation semantics",
"schema": {
"anyOf": [
{
"anyOf": [
{
"type": "null"
}
]
}
]
},
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false
}
]
},
{
"description": "nested anyOf, to check validation semantics",
"schema": {
Expand Down
74 changes: 73 additions & 1 deletion test/JSON-Schema-Test-Suite/tests/draft7/const.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
]
},
{
"description": "const with 0 does not match false",
"description": "const with 0 does not match other zero-like types",
"schema": {"const": 0},
"tests": [
{
Expand All @@ -143,6 +143,21 @@
"description": "float zero is valid",
"data": 0.0,
"valid": true
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
},
{
"description": "empty string is invalid",
"data": "",
"valid": false
}
]
},
Expand All @@ -166,5 +181,62 @@
"valid": true
}
]
},
{
"description": "const with -2.0 matches integer and float types",
"schema": {"const": -2.0},
"tests": [
{
"description": "integer -2 is valid",
"data": -2,
"valid": true
},
{
"description": "integer 2 is invalid",
"data": 2,
"valid": false
},
{
"description": "float -2.0 is valid",
"data": -2.0,
"valid": true
},
{
"description": "float 2.0 is invalid",
"data": 2.0,
"valid": false
},
{
"description": "float -2.00001 is invalid",
"data": -2.00001,
"valid": false
}
]
},
{
"description": "float and integers are equal up to 64-bit representation limits",
"schema": {"const": 9007199254740992},
"tests": [
{
"description": "integer is valid",
"data": 9007199254740992,
"valid": true
},
{
"description": "integer minus one is invalid",
"data": 9007199254740991,
"valid": false
},
{
"description": "float is valid",
"data": 9007199254740992.0,
"valid": true
},
{
"description": "float minus one is invalid",
"data": 9007199254740991.0,
"valid": false
}
]
}
]
30 changes: 5 additions & 25 deletions test/JSON-Schema-Test-Suite/tests/draft7/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
"description": "object with one property",
"data": {"bar": 2},
"valid": true
},
{
"description": "non-object is valid",
"data": 1,
"valid": true
}
]
},
Expand Down Expand Up @@ -169,31 +174,6 @@
}
]
},
{
"description": "empty array of dependencies",
"schema": {
"dependencies": {
"foo": []
}
},
"tests": [
{
"description": "object with property is valid",
"data": { "foo": 1 },
"valid": true
},
{
"description": "empty object is valid",
"data": {},
"valid": true
},
{
"description": "non-object is valid",
"data": 1,
"valid": true
}
]
},
{
"description": "dependencies with escaped characters",
"schema": {
Expand Down
31 changes: 31 additions & 0 deletions test/JSON-Schema-Test-Suite/tests/draft7/enum.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@
}
]
},
{
"description": "heterogeneous enum-with-null validation",
"schema": { "enum": [6, null] },
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true
},
{
"description": "number is valid",
"data": 6,
"valid": true
},
{
"description": "something else is invalid",
"data": "test",
"valid": false
}
]
},
{
"description": "enums in properties",
"schema": {
Expand All @@ -52,6 +73,16 @@
"data": {"foo":"foo", "bar":"bar"},
"valid": true
},
{
"description": "wrong foo value",
"data": {"foo":"foot", "bar":"bar"},
"valid": false
},
{
"description": "wrong bar value",
"data": {"foo":"foo", "bar":"bart"},
"valid": false
},
{
"description": "missing optional property is valid",
"data": {"bar":"bar"},
Expand Down
Loading

0 comments on commit be1792d

Please sign in to comment.