Skip to content

Commit

Permalink
Merge pull request #157 from epoberezkin/const
Browse files Browse the repository at this point in the history
draft-06: const validation
  • Loading branch information
Evgeny Poberezkin authored Feb 12, 2017
2 parents 0799212 + ba6c582 commit 95b4648
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tests/draft6/const.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[
{
"description": "const validation",
"schema": {"const": 2},
"tests": [
{
"description": "same value is valid",
"data": 2,
"valid": true
},
{
"description": "another value is invalid",
"data": 5,
"valid": false
},
{
"description": "another type is invalid",
"data": "a",
"valid": false
}
]
},
{
"description": "const with object",
"schema": {"const": {"foo": "bar", "baz": "bax"}},
"tests": [
{
"description": "same object is valid",
"data": {"foo": "bar", "baz": "bax"},
"valid": true
},
{
"description": "same object with different property order is valid",
"data": {"baz": "bax", "foo": "bar"},
"valid": true
},
{
"description": "another object is invalid",
"data": {"foo": "bar"},
"valid": false
},
{
"description": "another type is invalid",
"data": [1, 2],
"valid": false
}
]
},
{
"description": "const with null",
"schema": {"const": null},
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true
},
{
"description": "not null is invalid",
"data": 0,
"valid": false
}
]
}
]

0 comments on commit 95b4648

Please sign in to comment.