OpenAPI parameters with the same name and different "in" types cause "Duplicate identifier" error in types.gen.ts
brimstony opened this issue · comments
Description
In the OAS 3.0 spec below, there is a query parameter and a header parameter that both use the name "identifier". Although it is silly, to some extent it makes sense and is allowed by the OAS 3.0 spec.
When the types are generated, it creates the following:
export type GetDataSubjectPurposesByIdentifierUsingGetData = {
/**
* Data Subject Identifier (prefer the header parameter)
*/
identifier?: string;
/**
* Data Subject Identifier (prefer the header parameter)
*/
identifier?: string;
....
};
Which of course, errors with "Duplicate identifier 'identifier'".
OpenAPI specification (optional)
"/api/consentmanager/v1/datasubjects/purposes": {
"get": {
"deprecated": true,
"description": "Gets a paged list of Purposes for a Data Subject identifier. We strongly suggest using GET [/datasubjects/profiles](https://developer.onetrust.com/onetrust/reference/getdatasubjectprofileusingget) instead, as this endpoint has been deprecated.",
"operationId": "getDataSubjectPurposesByIdentifierUsingGET",
"parameters": [
{
"description": "Data Subject Identifier (prefer the header parameter)",
"in": "query",
"name": "identifier",
"required": false,
"schema": {
"type": "string"
}
},
{
"description": "Data Subject Identifier (prefer the header parameter)",
"in": "header",
"name": "identifier",
"required": false,
"schema": {
"type": "string"
}
},
....
]
}
Configuration
openapi-ts -i docs/onetrust.json -o src/functions/client
System information (optional)
No response
Hey @brimstony, this is fixed in the new Fetch API client. It won't be fixed for old clients as it's a huge breaking change
Understood, thank you!