diff --git a/json/README.md b/json/README.md index d0b4640..7c4cfbf 100644 --- a/json/README.md +++ b/json/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/json/tests/draft3/default.json b/json/tests/draft3/default.json new file mode 100644 index 0000000..1762977 --- /dev/null +++ b/json/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/json/tests/draft4/default.json b/json/tests/draft4/default.json new file mode 100644 index 0000000..1762977 --- /dev/null +++ b/json/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 + } + ] + } +]