Title: Handle Default Responses in response generation · Issue #124 · openapi-generators/openapi-python-client · GitHub
Open Graph Title: Handle Default Responses in response generation · Issue #124 · openapi-generators/openapi-python-client
X Title: Handle Default Responses in response generation · Issue #124 · openapi-generators/openapi-python-client
Description: Describe the bug In the specifications, default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. response = response_from_data(status_code=int(code), data=response_data) ...
Open Graph Description: Describe the bug In the specifications, default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. response = response_from_data(sta...
X Description: Describe the bug In the specifications, default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. response = response_from_data(sta...
Opengraph URL: https://github.com/openapi-generators/openapi-python-client/issues/124
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Handle Default Responses in response generation","articleBody":"**Describe the bug**\r\nIn the [specifications](https://swagger.io/specification/#responses-object), default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification.\r\n\r\n response = response_from_data(status_code=int(code), data=response_data)\r\nValueError: invalid literal for int() with base 10: 'default'\r\n\r\n**To Reproduce**\r\nSample code from a openapi spec. \r\n```\r\n responses:\r\n \"200\":\r\n description: An array of items\r\n content:\r\n application/json:\r\n schema:\r\n allOf:\r\n - $ref: \"#/components/schemas/ItemsArrayObj\"\r\n default:\r\n description: Unknown error\r\n content:\r\n application/json:\r\n schema:\r\n $ref: \"#/components/schemas/Error\"\r\n```\r\n\r\n**Expected behavior**\r\nCode should generate a custom ApiResponseError class if default is defined, with content of error being a model of the reference/schema items\r\n\r\n**OpenAPI Spec File**\r\nSample code from a openapi spec. \r\n```\r\n responses:\r\n \"200\":\r\n description: An array of items\r\n content:\r\n application/json:\r\n schema:\r\n allOf:\r\n - $ref: \"#/components/schemas/ItemsArrayObj\"\r\n default:\r\n description: Unknown error\r\n content:\r\n application/json:\r\n schema:\r\n $ref: \"#/components/schemas/Error\"\r\n```\r\n\r\n\r\n**Desktop (please complete the following information):**\r\n - OS: Linux Mint\r\n - Python Version: 3.8.3\r\n - openapi-python-client version: git main","author":{"url":"https://github.com/bladecoates","@type":"Person","name":"bladecoates"},"datePublished":"2020-08-04T17:29:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/124/openapi-python-client/issues/124"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c56ef436-5084-e677-8684-8c306f54e44e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 91D8:2059C1:569944:767E60:698246E4 |
| html-safe-nonce | 7507759af25f8feb9ee57fe49ca6b7cf96f37ca562562f55c06519c6eaace77d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MUQ4OjIwNTlDMTo1Njk5NDQ6NzY3RTYwOjY5ODI0NkU0IiwidmlzaXRvcl9pZCI6IjY0NzA3Mjg4NTE1MzMyMTk1NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 85f6564fbeeca373caa930434e46c82512806f4588decc46db5b2cd55ad6d353 |
| hovercard-subject-tag | issue:672957337 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openapi-generators/openapi-python-client/124/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4d090d7379a12074468ca85574b19a722491863ce97c1b539e64ab49d4dddcb8/openapi-generators/openapi-python-client/issues/124 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4d090d7379a12074468ca85574b19a722491863ce97c1b539e64ab49d4dddcb8/openapi-generators/openapi-python-client/issues/124 |
| og:image:alt | Describe the bug In the specifications, default MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. response = response_from_data(sta... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bladecoates |
| hostname | github.com |
| expected-hostname | github.com |
| None | e2ebc70d7d37443ffd1ae8f91a253417e0725a69916687ec3b823f2451fb6caa |
| turbo-cache-control | no-preview |
| go-import | github.com/openapi-generators/openapi-python-client git https://github.com/openapi-generators/openapi-python-client.git |
| octolytics-dimension-user_id | 84925606 |
| octolytics-dimension-user_login | openapi-generators |
| octolytics-dimension-repository_id | 240776275 |
| octolytics-dimension-repository_nwo | openapi-generators/openapi-python-client |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 240776275 |
| octolytics-dimension-repository_network_root_nwo | openapi-generators/openapi-python-client |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6241ad74f49cf194bf94dad6a72d8792f1c2ab10 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width