Title: Multiple json content types in a single requestBody or response lead to duplicate types and client interface functions · Issue #1127 · oapi-codegen/oapi-codegen · GitHub
Open Graph Title: Multiple json content types in a single requestBody or response lead to duplicate types and client interface functions · Issue #1127 · oapi-codegen/oapi-codegen
X Title: Multiple json content types in a single requestBody or response lead to duplicate types and client interface functions · Issue #1127 · oapi-codegen/oapi-codegen
Description: openapi: 3.0.1 info: title: api version: "0.1.0" paths: /whatever: post: operationId: CreateWhatever requestBody: content: application/json-patch+json: schema: $ref: "#/components/schemas/Whatever" application/json: schema: $ref: "#/comp...
Open Graph Description: openapi: 3.0.1 info: title: api version: "0.1.0" paths: /whatever: post: operationId: CreateWhatever requestBody: content: application/json-patch+json: schema: $ref: "#/components/schemas/Whatever"...
X Description: openapi: 3.0.1 info: title: api version: "0.1.0" paths: /whatever: post: operationId: CreateWhatever requestBody: content: application/json-patch+json: schema: $ref: "#/components/sc...
Opengraph URL: https://github.com/oapi-codegen/oapi-codegen/issues/1127
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Multiple json content types in a single requestBody or response lead to duplicate types and client interface functions","articleBody":"```yaml\r\nopenapi: 3.0.1\r\ninfo:\r\n title: api\r\n version: \"0.1.0\"\r\npaths:\r\n /whatever:\r\n post:\r\n operationId: CreateWhatever\r\n requestBody:\r\n content:\r\n application/json-patch+json:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\n application/json:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\n text/json:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\n application/*+json:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\n responses:\r\n 201:\r\n description: Whatever created\r\n content:\r\n text/plain:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\n application/json:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\n text/json:\r\n schema:\r\n $ref: \"#/components/schemas/Whatever\"\r\ncomponents:\r\n schemas:\r\n Whatever:\r\n type: object\r\n properties:\r\n someProperty:\r\n type: string\r\n```\r\n\r\nGenerated Client Boilerplate:\r\n```go\r\n// CreateWhateverJSONRequestBody defines body for CreateWhatever for application/*+json ContentType.\r\ntype CreateWhateverJSONRequestBody = Whatever\r\n\r\n// CreateWhateverJSONRequestBody defines body for CreateWhatever for application/json ContentType.\r\ntype CreateWhateverJSONRequestBody = Whatever\r\n\r\n// CreateWhateverJSONRequestBody defines body for CreateWhatever for application/json-patch+json ContentType.\r\ntype CreateWhateverJSONRequestBody = Whatever\r\n\r\n...\r\n\r\n// The interface specification for the client above.\r\ntype ClientInterface interface {\r\n\t// CreateWhatever request with any body\r\n\tCreateWhateverWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)\r\n\r\n\tCreateWhatever(ctx context.Context, body CreateWhateverJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)\r\n\r\n\tCreateWhatever(ctx context.Context, body CreateWhateverJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)\r\n\r\n\tCreateWhatever(ctx context.Context, body CreateWhateverJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)\r\n\r\n...\r\n\r\n// ClientWithResponsesInterface is the interface specification for the client with responses above.\r\ntype ClientWithResponsesInterface interface {\r\n\t// CreateWhatever request with any body\r\n\tCreateWhateverWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateWhateverResponse, error)\r\n\r\n\tCreateWhateverWithResponse(ctx context.Context, body CreateWhateverJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateWhateverResponse, error)\r\n\r\n\tCreateWhateverWithResponse(ctx context.Context, body CreateWhateverJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateWhateverResponse, error)\r\n\r\n\tCreateWhateverWithResponse(ctx context.Context, body CreateWhateverJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateWhateverResponse, error)\r\n}\r\n}\r\n```","author":{"url":"https://github.com/jlengelsen","@type":"Person","name":"jlengelsen"},"datePublished":"2023-06-28T11:59:48Z","url":"https://github.com/oapi-codegen/oapi-codegen/issues/1127"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:bef1c80e-33b1-b6ff-d312-df3152e14b4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D996:42EA3:FC0205:1606D3D:6AFA09CB |
| html-safe-nonce | 70c21717b335ed5d4e45cf980bbf1d69ac36ea4499c8b45631701be6776eaefd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTk2OjQyRUEzOkZDMDIwNToxNjA2RDNEOjZBRkEwOUNCIiwidmlzaXRvcl9pZCI6Ijc2NzY4MjM0MzU4NTczNTE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1bc01d152e1d90297a68ad92ec9827a476cc1f0b9cff929b7cb2d27bb610a499 |
| hovercard-subject-tag | issue:1778794653 |
| 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/oapi-codegen/oapi-codegen/1127/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7c9ccc1d995c3fddd4c46c895faa807725317c0749ce6718a169e60a89e7202c/oapi-codegen/oapi-codegen/issues/1127 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7c9ccc1d995c3fddd4c46c895faa807725317c0749ce6718a169e60a89e7202c/oapi-codegen/oapi-codegen/issues/1127 |
| og:image:alt | openapi: 3.0.1 info: title: api version: "0.1.0" paths: /whatever: post: operationId: CreateWhatever requestBody: content: application/json-patch+json: schema: $ref: "#/components/schemas/Whatever"... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jlengelsen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-preview |
| go-import | github.com/oapi-codegen/oapi-codegen git https://github.com/oapi-codegen/oapi-codegen.git |
| octolytics-dimension-user_id | 142752710 |
| octolytics-dimension-user_login | oapi-codegen |
| octolytics-dimension-repository_id | 173009358 |
| octolytics-dimension-repository_nwo | oapi-codegen/oapi-codegen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 173009358 |
| octolytics-dimension-repository_network_root_nwo | oapi-codegen/oapi-codegen |
| 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 | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width