|
| 1 | +[ |
| 2 | + { |
| 3 | + "description": |
| 4 | + "additionalProperties being false does not allow other properties", |
| 5 | + "schema": { |
| 6 | + "properties": {"foo": {}, "bar": {}}, |
| 7 | + "patternProperties": { "^v": {} }, |
| 8 | + "additionalProperties": false |
| 9 | + }, |
| 10 | + "tests": [ |
| 11 | + { |
| 12 | + "description": "no additional properties is valid", |
| 13 | + "data": {"foo": 1}, |
| 14 | + "valid": true |
| 15 | + }, |
| 16 | + { |
| 17 | + "description": "an additional property is invalid", |
| 18 | + "data": {"foo" : 1, "bar" : 2, "quux" : "boom"}, |
| 19 | + "valid": false |
| 20 | + }, |
| 21 | + { |
| 22 | + "description": "ignores arrays", |
| 23 | + "data": [1, 2, 3], |
| 24 | + "valid": true |
| 25 | + }, |
| 26 | + { |
| 27 | + "description": "ignores strings", |
| 28 | + "data": "foobarbaz", |
| 29 | + "valid": true |
| 30 | + }, |
| 31 | + { |
| 32 | + "description": "ignores other non-objects", |
| 33 | + "data": 12, |
| 34 | + "valid": true |
| 35 | + }, |
| 36 | + { |
| 37 | + "description": "patternProperties are not additional properties", |
| 38 | + "data": {"foo":1, "vroom": 2}, |
| 39 | + "valid": true |
| 40 | + } |
| 41 | + ] |
| 42 | + }, |
| 43 | + { |
| 44 | + "description": "non-ASCII pattern with additionalProperties", |
| 45 | + "schema": { |
| 46 | + "patternProperties": {"^á": {}}, |
| 47 | + "additionalProperties": false |
| 48 | + }, |
| 49 | + "tests": [ |
| 50 | + { |
| 51 | + "description": "matching the pattern is valid", |
| 52 | + "data": {"ármányos": 2}, |
| 53 | + "valid": true |
| 54 | + }, |
| 55 | + { |
| 56 | + "description": "not matching the pattern is invalid", |
| 57 | + "data": {"élmény": 2}, |
| 58 | + "valid": false |
| 59 | + } |
| 60 | + ] |
| 61 | + }, |
| 62 | + { |
| 63 | + "description": |
| 64 | + "additionalProperties allows a schema which should validate", |
| 65 | + "schema": { |
| 66 | + "properties": {"foo": {}, "bar": {}}, |
| 67 | + "additionalProperties": {"type": "boolean"} |
| 68 | + }, |
| 69 | + "tests": [ |
| 70 | + { |
| 71 | + "description": "no additional properties is valid", |
| 72 | + "data": {"foo": 1}, |
| 73 | + "valid": true |
| 74 | + }, |
| 75 | + { |
| 76 | + "description": "an additional valid property is valid", |
| 77 | + "data": {"foo" : 1, "bar" : 2, "quux" : true}, |
| 78 | + "valid": true |
| 79 | + }, |
| 80 | + { |
| 81 | + "description": "an additional invalid property is invalid", |
| 82 | + "data": {"foo" : 1, "bar" : 2, "quux" : 12}, |
| 83 | + "valid": false |
| 84 | + } |
| 85 | + ] |
| 86 | + }, |
| 87 | + { |
| 88 | + "description": |
| 89 | + "additionalProperties can exist by itself", |
| 90 | + "schema": { |
| 91 | + "additionalProperties": {"type": "boolean"} |
| 92 | + }, |
| 93 | + "tests": [ |
| 94 | + { |
| 95 | + "description": "an additional valid property is valid", |
| 96 | + "data": {"foo" : true}, |
| 97 | + "valid": true |
| 98 | + }, |
| 99 | + { |
| 100 | + "description": "an additional invalid property is invalid", |
| 101 | + "data": {"foo" : 1}, |
| 102 | + "valid": false |
| 103 | + } |
| 104 | + ] |
| 105 | + }, |
| 106 | + { |
| 107 | + "description": "additionalProperties are allowed by default", |
| 108 | + "schema": {"properties": {"foo": {}, "bar": {}}}, |
| 109 | + "tests": [ |
| 110 | + { |
| 111 | + "description": "additional properties are allowed", |
| 112 | + "data": {"foo": 1, "bar": 2, "quux": true}, |
| 113 | + "valid": true |
| 114 | + } |
| 115 | + ] |
| 116 | + }, |
| 117 | + { |
| 118 | + "description": "additionalProperties should not look in applicators", |
| 119 | + "schema": { |
| 120 | + "allOf": [ |
| 121 | + {"properties": {"foo": {}}} |
| 122 | + ], |
| 123 | + "additionalProperties": {"type": "boolean"} |
| 124 | + }, |
| 125 | + "tests": [ |
| 126 | + { |
| 127 | + "description": "properties defined in allOf are not examined", |
| 128 | + "data": {"foo": 1, "bar": true}, |
| 129 | + "valid": false |
| 130 | + } |
| 131 | + ] |
| 132 | + } |
| 133 | +] |
0 commit comments