|
96 | 96 | }, |
97 | 97 | "instance": ["foo", 42], |
98 | 98 | "errors": [] |
| 99 | + }, |
| 100 | + { |
| 101 | + "description": "contains fails due to too many matching items with success explanations", |
| 102 | + "compatibility": "2019", |
| 103 | + "schema": { |
| 104 | + "contains": { "type": "string" }, |
| 105 | + "maxContains": 1 |
| 106 | + }, |
| 107 | + "instance": [42, "foo", "bar"], |
| 108 | + "errors": [ |
| 109 | + { |
| 110 | + "messageId": "contains-exact-message", |
| 111 | + "messageParams": { |
| 112 | + "minContains": 1, |
| 113 | + "maxContains": 1 |
| 114 | + }, |
| 115 | + "instanceLocation": "#", |
| 116 | + "schemaLocations": ["#/contains", "#/maxContains"], |
| 117 | + "alternatives": [ |
| 118 | + [ |
| 119 | + { |
| 120 | + "messageId": "type-success", |
| 121 | + "messageParams": { |
| 122 | + "actualType": "string" |
| 123 | + }, |
| 124 | + "instanceLocation": "#/1", |
| 125 | + "schemaLocations": ["#/contains/type"] |
| 126 | + } |
| 127 | + ], |
| 128 | + [ |
| 129 | + { |
| 130 | + "messageId": "type-success", |
| 131 | + "messageParams": { |
| 132 | + "actualType": "string" |
| 133 | + }, |
| 134 | + "instanceLocation": "#/2", |
| 135 | + "schemaLocations": ["#/contains/type"] |
| 136 | + } |
| 137 | + ] |
| 138 | + ] |
| 139 | + }, |
| 140 | + { |
| 141 | + "description": "contains fails with multiple object matches", |
| 142 | + "compatibility": "2019", |
| 143 | + "schema": { |
| 144 | + "contains": { |
| 145 | + "required": ["a"] |
| 146 | + }, |
| 147 | + "maxContains": 1 |
| 148 | + }, |
| 149 | + "instance": [{ "a": 1 }, { "a": 2 }], |
| 150 | + "errors": [ |
| 151 | + { |
| 152 | + "messageId": "contains-exact-message", |
| 153 | + "messageParams": { |
| 154 | + "minContains": 1, |
| 155 | + "maxContains": 1 |
| 156 | + }, |
| 157 | + "instanceLocation": "#", |
| 158 | + "schemaLocations": ["#/contains", "#/maxContains"], |
| 159 | + "alternatives": [ |
| 160 | + [ |
| 161 | + { |
| 162 | + "messageId": "required-success", |
| 163 | + "messageParams": { "property": "a" }, |
| 164 | + "instanceLocation": "#/0", |
| 165 | + "schemaLocations": ["#/contains/required"] |
| 166 | + } |
| 167 | + ], |
| 168 | + [ |
| 169 | + { |
| 170 | + "messageId": "required-success", |
| 171 | + "messageParams": { "property": "a" }, |
| 172 | + "instanceLocation": "#/1", |
| 173 | + "schemaLocations": ["#/contains/required"] |
| 174 | + } |
| 175 | + ] |
| 176 | + ] |
| 177 | + } |
| 178 | + ] |
| 179 | + } |
| 180 | + ] |
99 | 181 | } |
100 | 182 | ] |
101 | 183 | } |
0 commit comments