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 }}
Repository navigation
Redeclared Types when model name matches client endpoint id response name #1474
When generating types,client for the openai openapi spec, I see many errors similar to this example:
Duplicate types
// CreateChatCompletionResponse Represents a chat completion response returned by model, based on the provided input.typeCreateChatCompletionResponsestruct {
// Choices A list of chat completion choices. Can be more than one if `n` is greater than 1.Choices []struct {
// FinishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence,// `length` if the maximum number of tokens specified in the request was reached,// `content_filter` if content was omitted due to a flag from our content filters,// `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.FinishReasonCreateChatCompletionResponseChoicesFinishReason`json:"finish_reason"`// Index The index of the choice in the list of choices.Indexint`json:"index"`//etc...
}
//...typeCreateChatCompletionResponsestruct {
Body []byteHTTPResponse*http.ResponseJSON200*CreateChatCompletionResponse// name here matches both types
}
Error:
CreateChatCompletionResponse redeclared in this block
I believe this occurs when the schema for an operation's response has the same name as the generated name for <OperationId>Response, this is the yaml in question:
/chat/completions:
post:
operationId: createChatCompletiontags:
- Chatsummary: Creates a model response for the given chat conversation.requestBody:
required: truecontent:
application/json:
schema:
$ref: "#/components/schemas/CreateChatCompletionRequest"responses:
"200":
description: OKcontent:
application/json:
schema:
$ref: "#/components/schemas/CreateChatCompletionResponse"
Is there an expected flag to use to workaround this? Or is this a bug?
Reacted by Pascal van Buijtene, Clint J. Edwards, devgianlu and Ali Dabir
I had the same and would see this as a bug, end-users should not have to worry about this.
You can work around it by setting a response type suffix in you config, like this:
output-options:
response-type-suffix: Resp
Reacted by barbich, azertyalex and Rostislav
Reacted by Jamie Tanna, André Kühnert, azertyalex and Rostislav
Interesting! Yeah this looks like a bug. Glad there's a workaround in the meantime - I'll get it officially documented in #1254 - but an ideal solution would be to detect when there may be a clash, and rename the generated response type
Activity
pvanbuijtene commentedon Feb 26, 2024
I had the same and would see this as a bug, end-users should not have to worry about this.
You can work around it by setting a response type suffix in you config, like this:
jamietanna commentedon Mar 25, 2024
Interesting! Yeah this looks like a bug. Glad there's a workaround in the meantime - I'll get it officially documented in #1254 - but an ideal solution would be to detect when there may be a clash, and rename the generated response type
rostislaved commentedon Sep 24, 2025
Hi @jamietanna,
Any update on this?
Response was the most obvious template for naming these models. So I was surprised when I faced this issue
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution
feat: multi-pass type name resolution (#2213)
mromaszewicz commentedon Mar 2, 2026
This was addressed in #2213, please enable name conflict resolution via the output options and file a new issue if it doesn't work for you