You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2026. It is now read-only.
* fixed duplicate type names
* add typename dedup functions
* Fixup: use full-word suffixes and add regression test for issue oapi-codegen#200
- Rename auto-dedup suffixes to use full words: Parameter, Response,
RequestBody (instead of Param, Resp, ReqBody)
- Add internal/test/issues/issue-200/ with spec, config, generated code,
and a compile-time regression test that instantiates every expected type
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Gate duplicate type name resolution behind output-options config flag
Add ResolveTypeNameCollisions bool to OutputOptions and the JSON schema.
When false (the default), the codegen errors on duplicate type names as
before. When true, FixDuplicateTypeNames auto-renames colliding types.
Also cleans up ComponentType: removes unused constants, improves doc.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Marcin Romaszewicz <marcinr@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: configuration-schema.json
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -252,6 +252,11 @@
252
252
"type": "boolean",
253
253
"description": "Allows disabling the generation of an 'optional pointer' for an optional field that is a container type (such as a slice or a map), which ends up requiring an additional, unnecessary, `... != nil` check. A field can set `x-go-type-skip-optional-pointer: false` to still require the optional pointer.",
254
254
"default": false
255
+
},
256
+
"resolve-type-name-collisions": {
257
+
"type": "boolean",
258
+
"description": "When set to true, automatically renames types that collide across different OpenAPI component sections (schemas, parameters, requestBodies, responses, headers) by appending a suffix based on the component section (e.g., 'Parameter', 'Response', 'RequestBody'). Without this, the codegen will error on duplicate type names, requiring manual resolution via x-go-name.",
Copy file name to clipboardExpand all lines: pkg/codegen/configuration.go
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -300,6 +300,14 @@ type OutputOptions struct {
300
300
301
301
// PreferSkipOptionalPointerOnContainerTypes allows disabling the generation of an "optional pointer" for an optional field that is a container type (such as a slice or a map), which ends up requiring an additional, unnecessary, `... != nil` check
0 commit comments