summaryrefslogtreecommitdiff
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
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
-rw-r--r--README.md1
-rw-r--r--tests/draft3/default.json49
-rw-r--r--tests/draft4/default.json49
3 files changed, 99 insertions, 0 deletions
diff --git a/README.md b/README.md
index d0b4640..7c4cfbf 100644
--- a/README.md
+++ b/README.md
@@ -76,6 +76,7 @@ This suite is being used by:
* [json_schema (Dart)](https://github.com/patefacio/json_schema)
* [tv4 (JavaScript)](https://github.com/geraintluff/tv4)
* [Jsonary (JavaScript)](https://github.com/jsonary-js/jsonary)
+ * [json-schema (Ruby)](https://github.com/hoxworth/json-schema)
If you use it as well, please fork and send a pull request adding yourself to
the list :).
diff --git a/tests/draft3/default.json b/tests/draft3/default.json
new file mode 100644
index 0000000..1762977
--- /dev/null
+++ b/tests/draft3/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
+ }
+ ]
+ }
+]
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
+ }
+ ]
+ }
+]