-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
In 7.1.0 when a request uses a path parameter called index the typescript generated with the typescript-axios generator does not compile because it contains duplicate identifiers.
7.0.0 works correctly.
openapi-generator version
"@openapitools/openapi-generator-cli": "^2.7.0",
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "7.1.0"
}
}
OpenAPI declaration file content or url
https://gist.github.com/rmisiakexscientia/074283d6ef3e975dbd6250ef550b64c7
Generation Details
Steps to reproduce
npx openapi-generator-cli generate -g typescript-axios -i "./src/openapi.json" -o "./src/client" --additional-properties="apiPackage=clients,modelPackage=models,withoutPrefixEnums=false,withSeparateModelsAndApi=true"
Then in count-api.ts you get this
/**
* CountApi - functional programming interface
* @export
*/
export const CountApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = CountApiAxiosParamCreator(configuration)
return {
/**
*
* @param {CountControllerTotalIndexEnum} index
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async countControllerTotal(index: CountControllerTotalIndexEnum, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.countControllerTotal(index, options);
const index = configuration?.serverIndex ?? 0;
const operationBasePath = operationServerMap['CountApi.countControllerTotal']?.[index]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
},
}
};which is invalid because index is both a parameter and declared inside the body
Related issues/PRs
Suggest a fix
Reactions are currently unavailable