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
code generated for components.requestBodies is invalid when described with same type as components.schemas #254
When the code is generated for types with the swagger definition containing components.requestBodies and components.schemas have the same type name, the resulting code generated is not compilable. e.g. Pet
paths:
/pets:
post:
summary: Add a new pet
requestBody:
$ref: '#/components/requestBodies/Pet'
/pets/{petId}
put:
summary: Update a pet
parameters: [ ... ]
requestBody:
$ref: '#/components/requestBodies/Pet'
components:
requestBodies: Pet:
description: A JSON object containing pet information
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
Reacted by Matt Mc, Evgeny, Andrew Starr-Bochicchio, Paul Gier and hayashi
I have also encountered the same issue, around the use of Response as a suffix for components. I have a solution that changes the suffix to HTTPResponse, which I think is less likely to create a conflict.
Could I put up a pull request for this?
EDIT: Appologies, did not have the time to look into adding this but it looks to be resolved in an upcoming release.
@dmhdeveloper I'd be very interested in seeing that, though I wonder if it would be better to make the response suffix a configuration detail so that there are no breaking changes. The idea would be the default would remain the same, but we could add an additional config to specify if we want to change the default suffix:
Activity
tooolbox commentedon Jan 3, 2021
Any advice on getting around this?
mahbh2001 commentedon Jan 3, 2021
tooolbox commentedon Jan 5, 2021
Yeah, I have a spec I don't want to mess with.
Ideally the types generated for request bodies have some kind of configurable suffix to allow devs to resolve conflicts like this.
dmhdeveloper commentedon May 13, 2021
I have also encountered the same issue, around the use of
Responseas a suffix for components. I have a solution that changes the suffix toHTTPResponse, which I think is less likely to create a conflict.Could I put up a pull request for this?
EDIT: Appologies, did not have the time to look into adding this but it looks to be resolved in an upcoming release.
DannyHinshaw commentedon Aug 17, 2021
@dmhdeveloper I'd be very interested in seeing that, though I wonder if it would be better to make the response suffix a configuration detail so that there are no breaking changes. The idea would be the default would remain the same, but we could add an additional config to specify if we want to change the default suffix:
I'd be more than willing to help with this as well as we're running into issues with duplicate types generated from specs from a 3rd party.
Thoughts?
ryan-bever commentedon Jul 4, 2022
Just ran into this as well. I can work-around the issue, but since this library is so great would like to see this issue actually resolved.
mromaszewicz commentedon Feb 7, 2026
The experimental v3 codegen in
/experimentalshould support this.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