Commit 9f6ef38
committed
fix(openapi): handle non-numeric OpenAPI response keys in return-doc
sorted() used int(item[0]) as the sort key over the Responses Object,
which raised ValueError for valid non-numeric keys such as 'default' or
range codes ('2XX'). These are common in real specs, so loading any
OpenAPI toolset whose operation declares a 'default' response crashed.
Non-numeric keys are now ordered after numeric status codes.1 parent 4cee97f commit 9f6ef38
2 files changed
Lines changed: 25 additions & 2 deletions
File tree
- src/google/adk/tools/openapi_tool/common
- tests/unittests/tools/openapi_tool/common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
232 | 236 | | |
233 | 237 | | |
234 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
395 | 414 | | |
396 | 415 | | |
397 | 416 | | |
| |||
0 commit comments