|
6 | 6 | { |
7 | 7 | "description": "oneOf", |
8 | 8 | "schema": { |
9 | | - "oneOf": [ |
10 | | - { "type": "string" }, |
11 | | - { "type": "number" } |
12 | | - ] |
| 9 | + "oneOf": [{ "type": "string" }, { "type": "number" }] |
13 | 10 | }, |
14 | 11 | "instance": null, |
15 | 12 | "errors": [ |
|
46 | 43 | { |
47 | 44 | "description": "oneOf more than one match", |
48 | 45 | "schema": { |
49 | | - "oneOf": [ |
50 | | - { "type": "integer" }, |
51 | | - { "type": "number" } |
52 | | - ] |
| 46 | + "oneOf": [{ "type": "integer" }, { "type": "number" }] |
53 | 47 | }, |
54 | 48 | "instance": 1, |
55 | 49 | "errors": [ |
|
66 | 60 | { |
67 | 61 | "description": "oneOf pass", |
68 | 62 | "schema": { |
69 | | - "oneOf": [ |
70 | | - { "type": "string" }, |
71 | | - { "type": "number" } |
72 | | - ] |
| 63 | + "oneOf": [{ "type": "string" }, { "type": "number" }] |
73 | 64 | }, |
74 | 65 | "instance": 42, |
75 | 66 | "errors": [] |
| 67 | + }, |
| 68 | + { |
| 69 | + "description": "oneOf more than one match with success explanations", |
| 70 | + "schema": { |
| 71 | + "oneOf": [{ "type": "integer" }, { "type": "number" }] |
| 72 | + }, |
| 73 | + "instance": 66, |
| 74 | + "errors": [ |
| 75 | + { |
| 76 | + "messageId": "oneOf-message", |
| 77 | + "messageParams": { "matchCount": 2 }, |
| 78 | + "alternatives": [ |
| 79 | + [ |
| 80 | + { |
| 81 | + "messageId": "type-success", |
| 82 | + "messageParams": { |
| 83 | + "actualType": "integer" |
| 84 | + }, |
| 85 | + "instanceLocation": "#", |
| 86 | + "schemaLocations": ["#/oneOf/0/type"] |
| 87 | + } |
| 88 | + ], |
| 89 | + [ |
| 90 | + { |
| 91 | + "messageId": "type-success", |
| 92 | + "messageParams": { |
| 93 | + "actualType": "number" |
| 94 | + }, |
| 95 | + "instanceLocation": "#", |
| 96 | + "schemaLocations": ["#/oneOf/1/type"] |
| 97 | + } |
| 98 | + ] |
| 99 | + ], |
| 100 | + "instanceLocation": "#", |
| 101 | + "schemaLocations": ["#/oneOf"] |
| 102 | + } |
| 103 | + ] |
| 104 | + }, |
| 105 | + { |
| 106 | + "description": "oneOf more than one match with failed alternatives ignored", |
| 107 | + "schema": { |
| 108 | + "oneOf": [ |
| 109 | + { "required": ["a"] }, |
| 110 | + { "required": ["b"] }, |
| 111 | + { "required": ["c"] } |
| 112 | + ] |
| 113 | + }, |
| 114 | + "instance": { "a": 1, "b": 2 }, |
| 115 | + "errors": [ |
| 116 | + { |
| 117 | + "messageId": "oneOf-message", |
| 118 | + "messageParams": { "matchCount": 2 }, |
| 119 | + "alternatives": [ |
| 120 | + [ |
| 121 | + { |
| 122 | + "messageId": "required-success", |
| 123 | + "messageParams": { |
| 124 | + "property": "a" |
| 125 | + }, |
| 126 | + "instanceLocation": "#", |
| 127 | + "schemaLocations": ["#/oneOf/0/required"] |
| 128 | + } |
| 129 | + ], |
| 130 | + [ |
| 131 | + { |
| 132 | + "messageId": "required-success", |
| 133 | + "messageParams": { |
| 134 | + "property": "b" |
| 135 | + }, |
| 136 | + "instanceLocation": "#", |
| 137 | + "schemaLocations": ["#/oneOf/1/required"] |
| 138 | + } |
| 139 | + ] |
| 140 | + ], |
| 141 | + "instanceLocation": "#", |
| 142 | + "schemaLocations": ["#/oneOf"] |
| 143 | + } |
| 144 | + ] |
| 145 | + }, |
| 146 | + { |
| 147 | + "description": "nested oneOf producing multiple matches in inner oneOf", |
| 148 | + "schema": { |
| 149 | + "oneOf": [ |
| 150 | + { |
| 151 | + "oneOf": [{ "required": ["a"] }, { "required": ["b"] }] |
| 152 | + }, |
| 153 | + { "required": ["c"] } |
| 154 | + ] |
| 155 | + }, |
| 156 | + "instance": { "a": 1, "b": 2 }, |
| 157 | + "errors": [ |
| 158 | + { |
| 159 | + "messageId": "oneOf-message", |
| 160 | + "messageParams": { "matchCount": 2 }, |
| 161 | + "instanceLocation": "#", |
| 162 | + "schemaLocations": ["#/oneOf/0/oneOf"], |
| 163 | + "alternatives": [ |
| 164 | + [ |
| 165 | + { |
| 166 | + "messageId": "required-success", |
| 167 | + "messageParams": { "property": "a" }, |
| 168 | + "instanceLocation": "#", |
| 169 | + "schemaLocations": ["#/oneOf/0/oneOf/0/required"] |
| 170 | + } |
| 171 | + ], |
| 172 | + [ |
| 173 | + { |
| 174 | + "messageId": "required-success", |
| 175 | + "messageParams": { "property": "b" }, |
| 176 | + "instanceLocation": "#", |
| 177 | + "schemaLocations": ["#/oneOf/0/oneOf/1/required"] |
| 178 | + } |
| 179 | + ] |
| 180 | + ] |
| 181 | + } |
| 182 | + ] |
76 | 183 | } |
77 | 184 | ] |
78 | 185 | } |
0 commit comments