Skip to content

Commit

Permalink
sync draft6 updates
Browse files Browse the repository at this point in the history
excluding those to optional
  • Loading branch information
graphaelli committed Mar 27, 2018
1 parent 91ff43d commit 76be2a9
Show file tree
Hide file tree
Showing 13 changed files with 191 additions and 13 deletions.
12 changes: 11 additions & 1 deletion testdata/draft6/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,20 @@
"valid": false
},
{
"description": "ignores non-objects",
"description": "ignores arrays",
"data": [1, 2, 3],
"valid": true
},
{
"description": "ignores strings",
"data": "foobarbaz",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
},
{
"description": "patternProperties are not additional properties",
"data": {"foo":1, "vroom": 2},
Expand Down
41 changes: 41 additions & 0 deletions testdata/draft6/anyOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,46 @@
"valid": false
}
]
},
{
"description": "anyOf complex types",
"schema": {
"anyOf": [
{
"properties": {
"bar": {"type": "integer"}
},
"required": ["bar"]
},
{
"properties": {
"foo": {"type": "string"}
},
"required": ["foo"]
}
]
},
"tests": [
{
"description": "first anyOf valid (complex)",
"data": {"bar": 2},
"valid": true
},
{
"description": "second anyOf valid (complex)",
"data": {"foo": "baz"},
"valid": true
},
{
"description": "both anyOf valid (complex)",
"data": {"foo": "baz", "bar": 2},
"valid": true
},
{
"description": "neither anyOf valid (complex)",
"data": {"foo": 2, "bar": "quux"},
"valid": false
}
]
}
]
21 changes: 21 additions & 0 deletions testdata/draft6/const.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@
}
]
},
{
"description": "const with array",
"schema": {"const": [{ "foo": "bar" }]},
"tests": [
{
"description": "same array is valid",
"data": [{"foo": "bar"}],
"valid": true
},
{
"description": "another array item is invalid",
"data": [2],
"valid": false
},
{
"description": "array with additional items is invalid",
"data": [1, 2, 3],
"valid": false
}
]
},
{
"description": "const with null",
"schema": {"const": null},
Expand Down
4 changes: 2 additions & 2 deletions testdata/draft6/definitions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"description": "valid definition",
"schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
"schema": {"$ref": "http://json-schema.org/draft-06/schema#"},
"tests": [
{
"description": "valid definition schema",
Expand All @@ -16,7 +16,7 @@
},
{
"description": "invalid definition",
"schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
"schema": {"$ref": "http://json-schema.org/draft-06/schema#"},
"tests": [
{
"description": "invalid definition schema",
Expand Down
14 changes: 12 additions & 2 deletions testdata/draft6/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,18 @@
"valid": false
},
{
"description": "ignores non-objects",
"data": "foo",
"description": "ignores arrays",
"data": ["bar"],
"valid": true
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
]
Expand Down
12 changes: 11 additions & 1 deletion testdata/draft6/maxProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@
"valid": false
},
{
"description": "ignores non-objects",
"description": "ignores arrays",
"data": [1, 2, 3],
"valid": true
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
]
}
Expand Down
12 changes: 11 additions & 1 deletion testdata/draft6/minProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@
"valid": false
},
{
"description": "ignores non-objects",
"description": "ignores arrays",
"data": [],
"valid": true
},
{
"description": "ignores strings",
"data": "",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
]
}
Expand Down
41 changes: 41 additions & 0 deletions testdata/draft6/oneOf.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,46 @@
"valid": false
}
]
},
{
"description": "oneOf complex types",
"schema": {
"oneOf": [
{
"properties": {
"bar": {"type": "integer"}
},
"required": ["bar"]
},
{
"properties": {
"foo": {"type": "string"}
},
"required": ["foo"]
}
]
},
"tests": [
{
"description": "first oneOf valid (complex)",
"data": {"bar": 2},
"valid": true
},
{
"description": "second oneOf valid (complex)",
"data": {"foo": "baz"},
"valid": true
},
{
"description": "both oneOf valid (complex)",
"data": {"foo": "baz", "bar": 2},
"valid": false
},
{
"description": "neither oneOf valid (complex)",
"data": {"foo": 2, "bar": "quux"},
"valid": false
}
]
}
]
12 changes: 11 additions & 1 deletion testdata/draft6/patternProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@
"valid": false
},
{
"description": "ignores non-objects",
"description": "ignores arrays",
"data": ["foo"],
"valid": true
},
{
"description": "ignores strings",
"data": "foo",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
Expand Down
7 changes: 6 additions & 1 deletion testdata/draft6/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@
"valid": true
},
{
"description": "ignores non-objects",
"description": "ignores arrays",
"data": [],
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
]
},
Expand Down
14 changes: 12 additions & 2 deletions testdata/draft6/propertyNames.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@
"valid": true
},
{
"description": "non-object is valid",
"data": [],
"description": "ignores arrays",
"data": [1, 2, 3, 4],
"valid": true
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
]
Expand Down
2 changes: 1 addition & 1 deletion testdata/draft6/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
},
{
"description": "remote ref, containing refs itself",
"schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
"schema": {"$ref": "http://json-schema.org/draft-06/schema#"},
"tests": [
{
"description": "remote ref valid",
Expand Down
12 changes: 11 additions & 1 deletion testdata/draft6/required.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@
"valid": false
},
{
"description": "ignores non-objects",
"description": "ignores arrays",
"data": [],
"valid": true
},
{
"description": "ignores strings",
"data": "",
"valid": true
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
}
Expand Down

0 comments on commit 76be2a9

Please sign in to comment.