Title: Use Optional for Query Params Instead of Union[Unset, ...] · Issue #285 · openapi-generators/openapi-python-client · GitHub
Open Graph Title: Use Optional for Query Params Instead of Union[Unset, ...] · Issue #285 · openapi-generators/openapi-python-client
X Title: Use Optional for Query Params Instead of Union[Unset, ...] · Issue #285 · openapi-generators/openapi-python-client
Description: Is your feature request related to a problem? Please describe. Although I'd like to keep Unset for body params, it makes a lot less sense for query params. I'd like non-required query params to return to the use of Optional. While it wou...
Open Graph Description: Is your feature request related to a problem? Please describe. Although I'd like to keep Unset for body params, it makes a lot less sense for query params. I'd like non-required query params to ret...
X Description: Is your feature request related to a problem? Please describe. Although I'd like to keep Unset for body params, it makes a lot less sense for query params. I'd like non-required query param...
Opengraph URL: https://github.com/openapi-generators/openapi-python-client/issues/285
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use Optional for Query Params Instead of Union[Unset, ...]","articleBody":"**Is your feature request related to a problem? Please describe.**\r\n\r\nAlthough I'd like to keep `Unset` for body params, it makes a lot less sense for query params. I'd like non-required query params to return to the use of `Optional`.\r\n\r\nWhile it would be inconsistent with the way we handle body params, I like that it encapsulates `Unset` (which is something of a workaround) more tightly.\r\n\r\n**Describe the solution you'd like**\r\n\r\nGiven:\r\n\r\n```\r\n'/things':\r\n get:\r\n tags:\r\n - things\r\n operationId: getThings\r\n parameters:\r\n - name: size\r\n in: query\r\n schema:\r\n type: int\r\n```\r\n\r\nI'd like the signature to look like:\r\n\r\n```\r\ndef sync_detailed(\r\n *,\r\n client: Client,\r\n size: Optional[int] = None,\r\n) -\u003e Response[Thing]:\r\n```\r\n\r\n**Instead** of:\r\n\r\n```\r\ndef sync_detailed(\r\n *,\r\n client: Client,\r\n size: Union[Unset, int] = UNSET,\r\n) -\u003e Response[Thing]:\r\n```\r\n\r\n**Describe alternatives you've considered**\r\n\r\nWe have several endpoints with a large number of optional query params that default to `None` in the wrapping interface. Will probably just iterate the dict and assign `Unset` everywhere we have `None` now.\r\n\r\n**Additional context**\r\n\r\nI feel like I did this to myself having requested the original `Unset` feature. 😅\r\n","author":{"url":"https://github.com/bowenwr","@type":"Person","name":"bowenwr"},"datePublished":"2021-01-05T13:13:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/285/openapi-python-client/issues/285"}
| 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:c715a1b6-0567-63c4-00e2-78cc8e13140d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0F6:3E6437:1593FAB:1CAB0D8:69814DC8 |
| html-safe-nonce | c1b44717d60afc19e91e1dabbbb10e788c4e464b4ad73d322fb3c66f79d72980 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEY2OjNFNjQzNzoxNTkzRkFCOjFDQUIwRDg6Njk4MTREQzgiLCJ2aXNpdG9yX2lkIjoiMjM0NjMwNTU0OTk4NzA0MDcxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 587d7237414bdcbd82136bbce65afb5d7802a78196d99660bf0b30d1d10c8aed |
| hovercard-subject-tag | issue:779009943 |
| 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/285/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f741c8acfaed777776fd42f333afe70a8e0de72a6a69f6c03f30284ed1de2471/openapi-generators/openapi-python-client/issues/285 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f741c8acfaed777776fd42f333afe70a8e0de72a6a69f6c03f30284ed1de2471/openapi-generators/openapi-python-client/issues/285 |
| og:image:alt | Is your feature request related to a problem? Please describe. Although I'd like to keep Unset for body params, it makes a lot less sense for query params. I'd like non-required query params to ret... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bowenwr |
| hostname | github.com |
| expected-hostname | github.com |
| None | e5c6a4b0d37e7dc8f18034781c9e3e492fdd80eb16410763ec244c3e1caf0805 |
| 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 | 906ec698502db8129a94bb04f4413119a1291133 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width