openapi-typescript-codegen
openapi-typescript-codegen copied to clipboard
Path parameter and query parameter with same name results in duplicate property
Describe the bug I have an OAS where an endpoint has a path parameter and a query parameter with the same name:
"/some/endpoint/with/event/{eventId}": {
"get": {
...
"operationId": "getCategoryGroupEventUsingGET",
"parameters": [
...
{
"name": "eventId",
"in": "path",
"description": "event Id",
"required": true,
"type": "string"
},
...
{
"name": "eventId",
"in": "query",
"required": false,
"type": "string"
},
...
This produces a method that takes as argument an object with duplicate properties:
public getCategoryGroupEventUsingGet({
...
eventId,
...
eventId,
...
}: {
...
/**
* event Id
*/
eventId: string,
...
eventId?: string,
...
}): CancelablePromise<BetOfferResponse> {
This produces the error the name `eventId` is bound more than once in this parameter list.
How should I deal with an OAS that contains an endpoint with a path parameter and query parameter with the same name?
This OAS is maintained by a third party. So ideally I would not like to make any changes to the OAS.
I'll look at this @michael-pxr
@michael-pxr this is fixed in @nicolas-chaulet/openapi-typescript-codegen! 🎉