diff options
author | bapt <bapt@FreeBSD.org> | 2014-03-22 17:28:14 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2014-03-22 17:28:14 +0000 |
commit | b471b8e16d6f2c205ae497402bad0a60c9cd6fa8 (patch) | |
tree | aabc973b2e4479277f8fe9aa0e8ed539826fdca3 /contrib/libucl/tests/schema/additionalProperties.json | |
parent | 841158cbfbfc6b699dbc10892c6cb878a66a5d7e (diff) | |
parent | 6b4d859b54b28a9d46c317ff21676aa37241f6de (diff) | |
download | FreeBSD-src-b471b8e16d6f2c205ae497402bad0a60c9cd6fa8.zip FreeBSD-src-b471b8e16d6f2c205ae497402bad0a60c9cd6fa8.tar.gz |
Update to 20140321
This brings schema validation
MFC after: 1 week
Diffstat (limited to 'contrib/libucl/tests/schema/additionalProperties.json')
-rw-r--r-- | contrib/libucl/tests/schema/additionalProperties.json | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/contrib/libucl/tests/schema/additionalProperties.json b/contrib/libucl/tests/schema/additionalProperties.json new file mode 100644 index 0000000..eb334c9 --- /dev/null +++ b/contrib/libucl/tests/schema/additionalProperties.json @@ -0,0 +1,69 @@ +[ + { + "description": + "additionalProperties being false does not allow other properties", + "schema": { + "properties": {"foo": {}, "bar": {}}, + "patternProperties": { "^v": {} }, + "additionalProperties": false + }, + "tests": [ + { + "description": "no additional properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "an additional property is invalid", + "data": {"foo" : 1, "bar" : 2, "quux" : "boom"}, + "valid": false + }, + { + "description": "ignores non-objects", + "data": [1, 2, 3], + "valid": true + }, + { + "description": "patternProperties are not additional properties", + "data": {"foo":1, "vroom": 2}, + "valid": true + } + ] + }, + { + "description": + "additionalProperties allows a schema which should validate", + "schema": { + "properties": {"foo": {}, "bar": {}}, + "additionalProperties": {"type": "boolean"} + }, + "tests": [ + { + "description": "no additional properties is valid", + "data": {"foo": 1}, + "valid": true + }, + { + "description": "an additional valid property is valid", + "data": {"foo" : 1, "bar" : 2, "quux" : true}, + "valid": true + }, + { + "description": "an additional invalid property is invalid", + "data": {"foo" : 1, "bar" : 2, "quux" : 12}, + "valid": false + } + ] + }, + { + "description": "additionalProperties are allowed by default", + "schema": {"properties": {"foo": {}, "bar": {}}}, + "tests": [ + { + "description": "additional properties are allowed", + "data": {"foo": 1, "bar": 2, "quux": true}, + "valid": true + } + ] + } +] |