From 45cf1fb8a6a0b7ea1ab8de8ea9fc7addb0ffd149 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Sun, 7 Dec 2014 12:22:33 -0500 Subject: [PATCH] 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 --- README.md | 1 + tests/draft3/default.json | 49 +++++++++++++++++++++++++++++++++++++++ tests/draft4/default.json | 49 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 tests/draft3/default.json create mode 100644 tests/draft4/default.json 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 + } + ] + } +]