Title: Generating different structs for different error codes · Issue #2085 · oapi-codegen/oapi-codegen · GitHub
Open Graph Title: Generating different structs for different error codes · Issue #2085 · oapi-codegen/oapi-codegen
X Title: Generating different structs for different error codes · Issue #2085 · oapi-codegen/oapi-codegen
Description: We use server code generation with the strict-server: true parameter. During generation, we obtain the following structures for the response GetHealthcheck200JSONResponse{ Timestamp: time.Now().UnixMilli(), } GetHealthcheck500JSONRespons...
Open Graph Description: We use server code generation with the strict-server: true parameter. During generation, we obtain the following structures for the response GetHealthcheck200JSONResponse{ Timestamp: time.Now().Uni...
X Description: We use server code generation with the strict-server: true parameter. During generation, we obtain the following structures for the response GetHealthcheck200JSONResponse{ Timestamp: time.Now().Uni...
Opengraph URL: https://github.com/oapi-codegen/oapi-codegen/issues/2085
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generating different structs for different error codes","articleBody":"We use server code generation with the `strict-server: true` parameter. During generation, we obtain the following structures for the response\n```go\nGetHealthcheck200JSONResponse{\n Timestamp: time.Now().UnixMilli(),\n}\n\nGetHealthcheck500JSONResponse{\n Timestamp: time.Now().UnixMilli(),\n}\n```\n\nAnd this happens with absolutely any response, a separate structure is created for each error code specified in the API contract. We find this inconvenient, but couldn't figure out how to make a generic structure or our own wrapper. Could you suggest how to be in this situation?","author":{"url":"https://github.com/VladislavYakonyuk","@type":"Person","name":"VladislavYakonyuk"},"datePublished":"2025-09-11T10:33:13Z","url":"https://github.com/oapi-codegen/oapi-codegen/issues/2085"}
| 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:4a042037-b502-e8fd-3272-75a97fb4a556 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B824:349533:296D0FC:368A4C6:6AF9BAB5 |
| html-safe-nonce | 91139ca3c419277241d3f3274c57c8b42e7ff59c8bbd86c8034f2a8841512b8d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODI0OjM0OTUzMzoyOTZEMEZDOjM2OEE0QzY6NkFGOUJBQjUiLCJ2aXNpdG9yX2lkIjoiMzAzNjcwMTI5NjM2Nzg3Njc4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b7d853391d59c9dd6916c298ceacc06c1826bb0e388eb78752ca034cde762f94 |
| hovercard-subject-tag | issue:3405908594 |
| 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/2085/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5e747b02ca79285d42364fe5af6a17a4683338b571f9fb2e8bcd8ddf6d8ac135/oapi-codegen/oapi-codegen/issues/2085 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5e747b02ca79285d42364fe5af6a17a4683338b571f9fb2e8bcd8ddf6d8ac135/oapi-codegen/oapi-codegen/issues/2085 |
| og:image:alt | We use server code generation with the strict-server: true parameter. During generation, we obtain the following structures for the response GetHealthcheck200JSONResponse{ Timestamp: time.Now().Uni... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | VladislavYakonyuk |
| 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