summaryrefslogtreecommitdiff
path: root/tests/draft4
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2014-12-07 12:22:33 -0500
committerJulian Berman <Julian@GrayVines.com>2014-12-07 12:22:33 -0500
commit45cf1fb8a6a0b7ea1ab8de8ea9fc7addb0ffd149 (patch)
tree4975aa7d8e6eb8bc2fbbd1af849800ca6e460650 /tests/draft4
parent43075285ed7271d9caaa02caa1747ead3cbb27ef (diff)
downloadjsonschema-45cf1fb8a6a0b7ea1ab8de8ea9fc7addb0ffd149.tar.gz
Squashed 'json/' changes from 3cef243..9208016
9208016 Merge pull request #67 from iainbeeston/defaults f57888c Added tests around the default property db28fee Merge pull request #63 from iainbeeston/patch-1 609944b Added the json-schema ruby gem to the list of libraries using the test suite git-subtree-dir: json git-subtree-split: 9208016d04c1b6774d5a17e8b037161873414edb
Diffstat (limited to 'tests/draft4')
-rw-r--r--tests/draft4/default.json49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/draft4/default.json b/tests/draft4/default.json
new file mode 100644
index 0000000..1762977
--- /dev/null
+++ b/tests/draft4/default.json
@@ -0,0 +1,49 @@
+[
+ {
+ "description": "invalid type for default",
+ "schema": {
+ "properties": {
+ "foo": {
+ "type": "integer",
+ "default": []
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid when property is specified",
+ "data": {"foo": 13},
+ "valid": true
+ },
+ {
+ "description": "still valid when the invalid default is used",
+ "data": {},
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "invalid string value for default",
+ "schema": {
+ "properties": {
+ "bar": {
+ "type": "string",
+ "minLength": 4,
+ "default": "bad"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid when property is specified",
+ "data": {"bar": "good"},
+ "valid": true
+ },
+ {
+ "description": "still valid when the invalid default is used",
+ "data": {},
+ "valid": true
+ }
+ ]
+ }
+]