diff options
Diffstat (limited to 'tests/draft4/default.json')
-rw-r--r-- | tests/draft4/default.json | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/draft4/default.json b/tests/draft4/default.json index 1762977..289a9b6 100644 --- a/tests/draft4/default.json +++ b/tests/draft4/default.json @@ -45,5 +45,35 @@ "valid": true } ] + }, + { + "description": "the default keyword does not do anything if the property is missing", + "schema": { + "type": "object", + "properties": { + "alpha": { + "type": "number", + "maximum": 3, + "default": 5 + } + } + }, + "tests": [ + { + "description": "an explicit property value is checked against maximum (passing)", + "data": { "alpha": 1 }, + "valid": true + }, + { + "description": "an explicit property value is checked against maximum (failing)", + "data": { "alpha": 5 }, + "valid": false + }, + { + "description": "missing properties are not filled in with the default", + "data": {}, + "valid": true + } + ] } ] |