Title: Generated path responses can conflict with schema definitions · Issue #2097 · oapi-codegen/oapi-codegen · GitHub
Open Graph Title: Generated path responses can conflict with schema definitions · Issue #2097 · oapi-codegen/oapi-codegen
X Title: Generated path responses can conflict with schema definitions · Issue #2097 · oapi-codegen/oapi-codegen
Description: Example: #2096 I noticed when using this generator that when attempting to use the "client with response", the returned type is busted. In particular, it's because there are two types with the same name: one seems to be defined in the sc...
Open Graph Description: Example: #2096 I noticed when using this generator that when attempting to use the "client with response", the returned type is busted. In particular, it's because there are two types with the same...
X Description: Example: #2096 I noticed when using this generator that when attempting to use the "client with response", the returned type is busted. In particular, it's because there are two types...
Opengraph URL: https://github.com/oapi-codegen/oapi-codegen/issues/2097
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generated path responses can conflict with schema definitions","articleBody":"_Example: https://github.com/oapi-codegen/oapi-codegen/pull/2096_\n\nI noticed when using this generator that when attempting to use the \"client with response\", the returned type is busted. In particular, it's because there are two `type`s with the same name: one seems to be defined in the schemas and one seems to be generated from the `paths` definition.\n\n\u003cimg width=\"637\" height=\"350\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/b880e7cd-d6b7-47c6-8047-cbefee3f9602\" />\n\n#### Example OAS\n\nhttps://github.com/joshprzybyszewski-wf/oapi-codegen/blob/jp/reproStatusConflict/examples/conflicting-fields/api.yaml#L6-L26\n\nhttps://github.com/joshprzybyszewski-wf/oapi-codegen/blob/jp/reproStatusConflict/examples/conflicting-fields/api.yaml#L27-L35\n\n#### How the problem appears\n\nThe presenting problem was that `resp.Status` gave me an IDE warning: `invalid operation: cannot indirect resp.Status (value of type func() string)`. In reality, there are two `type`s in the generated file with the same name:\n\nhttps://github.com/joshprzybyszewski-wf/oapi-codegen/blob/jp/reproStatusConflict/examples/conflicting-fields/conflicting_fields.gen.go#L23-L27\n\nhttps://github.com/joshprzybyszewski-wf/oapi-codegen/blob/jp/reproStatusConflict/examples/conflicting-fields/conflicting_fields.gen.go#L195-L207","author":{"url":"https://github.com/joshprzybyszewski-wf","@type":"Person","name":"joshprzybyszewski-wf"},"datePublished":"2025-09-24T16:32:01Z","url":"https://github.com/oapi-codegen/oapi-codegen/issues/2097"}
| 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:56f5dff2-faae-e919-ff63-1cfa40fd5ca6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE6A:141BC3:11B632:18AA79:6AF9C272 |
| html-safe-nonce | 4810cbe4083bb62ce73c912076caf36092b4e9c816e80a6a3cd7c96fc603a1ec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTZBOjE0MUJDMzoxMUI2MzI6MThBQTc5OjZBRjlDMjcyIiwidmlzaXRvcl9pZCI6IjIyNzgwODM5ODAyNDQ0MDI4MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8e252f5aef4fb8fc7ca4825ec5722aa9bfe2066ac69381b4ebefdae6ff3724dd |
| hovercard-subject-tag | issue:3450138135 |
| 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/2097/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ebf25cd542c859543fab47d7b292cd7a8a81c16fd149431fe4d3774a073a8975/oapi-codegen/oapi-codegen/issues/2097 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ebf25cd542c859543fab47d7b292cd7a8a81c16fd149431fe4d3774a073a8975/oapi-codegen/oapi-codegen/issues/2097 |
| og:image:alt | Example: #2096 I noticed when using this generator that when attempting to use the "client with response", the returned type is busted. In particular, it's because there are two types with the same... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | joshprzybyszewski-wf |
| 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