summaryrefslogtreecommitdiff
path: root/json/tests/draft3/required.json
diff options
context:
space:
mode:
Diffstat (limited to 'json/tests/draft3/required.json')
-rw-r--r--json/tests/draft3/required.json53
1 files changed, 53 insertions, 0 deletions
diff --git a/json/tests/draft3/required.json b/json/tests/draft3/required.json
new file mode 100644
index 0000000..aaaf024
--- /dev/null
+++ b/json/tests/draft3/required.json
@@ -0,0 +1,53 @@
+[
+ {
+ "description": "required validation",
+ "schema": {
+ "properties": {
+ "foo": {"required" : true},
+ "bar": {}
+ }
+ },
+ "tests": [
+ {
+ "description": "present required property is valid",
+ "data": {"foo": 1},
+ "valid": true
+ },
+ {
+ "description": "non-present required property is invalid",
+ "data": {"bar": 1},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "description": "required default validation",
+ "schema": {
+ "properties": {
+ "foo": {}
+ }
+ },
+ "tests": [
+ {
+ "description": "not required by default",
+ "data": {},
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "required explicitly false validation",
+ "schema": {
+ "properties": {
+ "foo": {"required": false}
+ }
+ },
+ "tests": [
+ {
+ "description": "not required if required is false",
+ "data": {},
+ "valid": true
+ }
+ ]
+ }
+]