summaryrefslogtreecommitdiff
path: root/tests/draft-future/additionalProperties.json
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2021-06-24 11:18:28 +0200
committerJulian Berman <Julian@GrayVines.com>2021-06-24 11:18:28 +0200
commit6d455c83e3fd953a9e762e596c52ce1fc4bf8740 (patch)
tree72b0efdf6215d1f0a90a1d2ce5d6c3f5ec5aba0d /tests/draft-future/additionalProperties.json
parentc19f0b4ee66ce10217185fa8d2c8b7a2784e3a31 (diff)
downloadjsonschema-6d455c83e3fd953a9e762e596c52ce1fc4bf8740.tar.gz
Squashed 'json/' changes from 09fd353f..0aefbb3d
0aefbb3d Merge pull request #491 from jdesrosiers/object-contains-tests 336ef8d2 Merge pull request #452 from LeifRilbe/rilbe/propertyNames-with-pattern 2dfbc79c Simplify the test case names as well. b6d0649d Add tests for contains with objects da687ca5 Enforce a consistent code style for contains tests b163efcf Merge pull request #490 from jdesrosiers/draft-future 7c8cb488 Initialize draft-future with 2020-12 tests 4d65d2df Merge pull request #483 from kylef/kylef/date ee9dcaa7 Merge pull request #485 from marksparkza/contains-with-false-if eaa5bffc Merge pull request #489 from json-schema-org/ether/more-recursiveRef 7c33b533 dynamic $recursiveRef test with cousin $recursiveAnchors 8a3a542b Fix invalid JSON error 8a89f58e Add tests combining remote refs and defs 3aec0d14 Add tests combining relative refs and defs a107d196 fix: $defs -> definitions in draft 6,7 tests 0c223de2 Remove a test for undefined $id behavior 4efec180 Test that "contains" does not fail due to false "if" subschema bf383b4c fix: make identifiers unique across tests 812f1f08 Merge pull request #484 from json-schema-org/ether/schemas-under-unknown-keywords 64f6b850 Test that identifiers are not found inside unrecognized keywords c69a89c6 Stricter date format constraints 93193442 Test cases for propertyNames with pattern - update after PR feedback. 8e4aad95 Test cases for propertyNames with pattern. git-subtree-dir: json git-subtree-split: 0aefbb3d80e0caa22f3782677cf09c61b2205aa7
Diffstat (limited to 'tests/draft-future/additionalProperties.json')
-rw-r--r--tests/draft-future/additionalProperties.json133
1 files changed, 133 insertions, 0 deletions
diff --git a/tests/draft-future/additionalProperties.json b/tests/draft-future/additionalProperties.json
new file mode 100644
index 0000000..381275a
--- /dev/null
+++ b/tests/draft-future/additionalProperties.json
@@ -0,0 +1,133 @@
+[
+ {
+ "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 arrays",
+ "data": [1, 2, 3],
+ "valid": true
+ },
+ {
+ "description": "ignores strings",
+ "data": "foobarbaz",
+ "valid": true
+ },
+ {
+ "description": "ignores other non-objects",
+ "data": 12,
+ "valid": true
+ },
+ {
+ "description": "patternProperties are not additional properties",
+ "data": {"foo":1, "vroom": 2},
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "non-ASCII pattern with additionalProperties",
+ "schema": {
+ "patternProperties": {"^á": {}},
+ "additionalProperties": false
+ },
+ "tests": [
+ {
+ "description": "matching the pattern is valid",
+ "data": {"ármányos": 2},
+ "valid": true
+ },
+ {
+ "description": "not matching the pattern is invalid",
+ "data": {"élmény": 2},
+ "valid": false
+ }
+ ]
+ },
+ {
+ "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 can exist by itself",
+ "schema": {
+ "additionalProperties": {"type": "boolean"}
+ },
+ "tests": [
+ {
+ "description": "an additional valid property is valid",
+ "data": {"foo" : true},
+ "valid": true
+ },
+ {
+ "description": "an additional invalid property is invalid",
+ "data": {"foo" : 1},
+ "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
+ }
+ ]
+ },
+ {
+ "description": "additionalProperties should not look in applicators",
+ "schema": {
+ "allOf": [
+ {"properties": {"foo": {}}}
+ ],
+ "additionalProperties": {"type": "boolean"}
+ },
+ "tests": [
+ {
+ "description": "properties defined in allOf are not examined",
+ "data": {"foo": 1, "bar": true},
+ "valid": false
+ }
+ ]
+ }
+]