Commit d75562e
committed
Don't make oneOf errors tagged unions
OpenAPI only lets you have one error per HTTP response code. This
is a problem when converting things because Smithy has no such
limitation. To address that, we added a toggle that lets you
disambiguate by making the body contents a `oneOf`, which is an
untagged union. The problem is that we made this a tagged union by
leaning on how Smithy converts Smithy's union shape, which is tagged.
To illustrate the problem, the OpenAPI modeled body technically now
declares the following body valid:
```json
{
"Error1" {
"foo": "bar"
}
}
```
But the model for the structure is:
```
@error("client")
@HttpError(400)
structure Error1 {
foo: String
}
```
And an actual valid body would be:
```json
{
"foo": "bar"
}
```
This commit turns the OpenAPI body into an untagged union instead,
which is how it should be.1 parent 2f5e97d commit d75562e
File tree
2 files changed
+13
-85
lines changed- smithy-openapi/src
- main/java/software/amazon/smithy/openapi/fromsmithy/protocols
- test/resources/software/amazon/smithy/openapi/fromsmithy/protocols
2 files changed
+13
-85
lines changedLines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
133 | | - | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
138 | 139 | | |
139 | | - | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
Lines changed: 9 additions & 81 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
| 157 | + | |
167 | 158 | | |
168 | 159 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 160 | + | |
179 | 161 | | |
180 | 162 | | |
181 | 163 | | |
182 | 164 | | |
183 | 165 | | |
184 | 166 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 167 | + | |
195 | 168 | | |
196 | 169 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 170 | + | |
207 | 171 | | |
208 | 172 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
| 173 | + | |
219 | 174 | | |
220 | 175 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
| 176 | + | |
231 | 177 | | |
232 | 178 | | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 179 | + | |
243 | 180 | | |
244 | 181 | | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 182 | + | |
255 | 183 | | |
256 | 184 | | |
257 | 185 | | |
| |||
269 | 197 | | |
270 | 198 | | |
271 | 199 | | |
272 | | - | |
| 200 | + | |
0 commit comments