-
-
Notifications
You must be signed in to change notification settings - Fork 218
Draft 07 validation test suite #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dedd3f1
Unmodified copy of draft6 tests to draft7
handrews 321db9a
Tests for if, then, and else keywords
handrews ea357f3
Update draft coverage information
handrews 0d64501
Tests for contentMediaType and contentEncoding
handrews ca342c9
Add tests for "date" and "time" formats
handrews 9b020b8
Add idn-email and idn-hostname format tests
handrews 1b43ffa
Partial IRI and IRI-reference test suite
handrews f58637d
Basic relative json pointer tests for format
handrews 0680b46
Restore regex format test from draft-03
handrews cf6e663
Apparently descriptions must be < 60 chars
handrews File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
[ | ||
{ | ||
"description": "additionalItems as schema", | ||
"schema": { | ||
"items": [{}], | ||
"additionalItems": {"type": "integer"} | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "additional items match schema", | ||
"data": [ null, 2, 3, 4 ], | ||
"valid": true | ||
}, | ||
{ | ||
"description": "additional items do not match schema", | ||
"data": [ null, 2, 3, "foo" ], | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "items is schema, no additionalItems", | ||
"schema": { | ||
"items": {}, | ||
"additionalItems": false | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "all items match schema", | ||
"data": [ 1, 2, 3, 4, 5 ], | ||
"valid": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "array of items with no additionalItems", | ||
"schema": { | ||
"items": [{}, {}, {}], | ||
"additionalItems": false | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "fewer number of items present", | ||
"data": [ 1, 2 ], | ||
"valid": true | ||
}, | ||
{ | ||
"description": "equal number of items present", | ||
"data": [ 1, 2, 3 ], | ||
"valid": true | ||
}, | ||
{ | ||
"description": "additional items are not permitted", | ||
"data": [ 1, 2, 3, 4 ], | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "additionalItems as false without items", | ||
"schema": {"additionalItems": false}, | ||
"tests": [ | ||
{ | ||
"description": | ||
"items defaults to empty schema so everything is valid", | ||
"data": [ 1, 2, 3, 4, 5 ], | ||
"valid": true | ||
}, | ||
{ | ||
"description": "ignores non-arrays", | ||
"data": {"foo" : "bar"}, | ||
"valid": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "additionalItems are allowed by default", | ||
"schema": {"items": [{"type": "integer"}]}, | ||
"tests": [ | ||
{ | ||
"description": "only the first item is validated", | ||
"data": [1, "foo", false], | ||
"valid": true | ||
} | ||
] | ||
} | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
[ | ||
{ | ||
"description": | ||
"additionalProperties being false does not allow other properties", | ||
"schema": { | ||
"properties": {"foo": {}, "bar": {}}, | ||
"patternProperties": { "^v": {} }, | ||
"additionalProperties": false | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "no additional properties is valid", | ||
"data": {"foo": 1}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an additional property is invalid", | ||
"data": {"foo" : 1, "bar" : 2, "quux" : "boom"}, | ||
"valid": false | ||
}, | ||
{ | ||
"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}, | ||
"valid": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": | ||
"additionalProperties allows a schema which should validate", | ||
"schema": { | ||
"properties": {"foo": {}, "bar": {}}, | ||
"additionalProperties": {"type": "boolean"} | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "no additional properties is valid", | ||
"data": {"foo": 1}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an additional valid property is valid", | ||
"data": {"foo" : 1, "bar" : 2, "quux" : true}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an additional invalid property is invalid", | ||
"data": {"foo" : 1, "bar" : 2, "quux" : 12}, | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": | ||
"additionalProperties can exist by itself", | ||
"schema": { | ||
"additionalProperties": {"type": "boolean"} | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "an additional valid property is valid", | ||
"data": {"foo" : true}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an additional invalid property is invalid", | ||
"data": {"foo" : 1}, | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "additionalProperties are allowed by default", | ||
"schema": {"properties": {"foo": {}, "bar": {}}}, | ||
"tests": [ | ||
{ | ||
"description": "additional properties are allowed", | ||
"data": {"foo": 1, "bar": 2, "quux": true}, | ||
"valid": true | ||
} | ||
] | ||
} | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
[ | ||
{ | ||
"description": "allOf", | ||
"schema": { | ||
"allOf": [ | ||
{ | ||
"properties": { | ||
"bar": {"type": "integer"} | ||
}, | ||
"required": ["bar"] | ||
}, | ||
{ | ||
"properties": { | ||
"foo": {"type": "string"} | ||
}, | ||
"required": ["foo"] | ||
} | ||
] | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "allOf", | ||
"data": {"foo": "baz", "bar": 2}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "mismatch second", | ||
"data": {"foo": "baz"}, | ||
"valid": false | ||
}, | ||
{ | ||
"description": "mismatch first", | ||
"data": {"bar": 2}, | ||
"valid": false | ||
}, | ||
{ | ||
"description": "wrong type", | ||
"data": {"foo": "baz", "bar": "quux"}, | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "allOf with base schema", | ||
"schema": { | ||
"properties": {"bar": {"type": "integer"}}, | ||
"required": ["bar"], | ||
"allOf" : [ | ||
{ | ||
"properties": { | ||
"foo": {"type": "string"} | ||
}, | ||
"required": ["foo"] | ||
}, | ||
{ | ||
"properties": { | ||
"baz": {"type": "null"} | ||
}, | ||
"required": ["baz"] | ||
} | ||
] | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "valid", | ||
"data": {"foo": "quux", "bar": 2, "baz": null}, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "mismatch base schema", | ||
"data": {"foo": "quux", "baz": null}, | ||
"valid": false | ||
}, | ||
{ | ||
"description": "mismatch first allOf", | ||
"data": {"bar": 2, "baz": null}, | ||
"valid": false | ||
}, | ||
{ | ||
"description": "mismatch second allOf", | ||
"data": {"foo": "quux", "bar": 2}, | ||
"valid": false | ||
}, | ||
{ | ||
"description": "mismatch both", | ||
"data": {"bar": 2}, | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "allOf simple types", | ||
"schema": { | ||
"allOf": [ | ||
{"maximum": 30}, | ||
{"minimum": 20} | ||
] | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "valid", | ||
"data": 25, | ||
"valid": true | ||
}, | ||
{ | ||
"description": "mismatch one", | ||
"data": 35, | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "allOf with boolean schemas, all true", | ||
"schema": {"allOf": [true, true]}, | ||
"tests": [ | ||
{ | ||
"description": "any value is valid", | ||
"data": "foo", | ||
"valid": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "allOf with boolean schemas, some false", | ||
"schema": {"allOf": [true, false]}, | ||
"tests": [ | ||
{ | ||
"description": "any value is invalid", | ||
"data": "foo", | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "allOf with boolean schemas, all false", | ||
"schema": {"allOf": [false, false]}, | ||
"tests": [ | ||
{ | ||
"description": "any value is invalid", | ||
"data": "foo", | ||
"valid": false | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to this file are also lgtm immediately :), thanks for updating it.