Bug Report Checklist
Description
When generating the model files the prefix is properly added once in front of the generated files. However, in the import statements the prefix is added twice resulting in erroneous statements breaking the build.
When e.g. SomePrefix is set for modelNamePrefix, then the following model files are generated for example-for-file-naming-option.yaml:
SomePrefixPetCategory.ts
SomePrefixPet.ts
However, within SomePrefixPet.ts it looks like this:
import type { SomePrefixPetCategory } from './SomePrefixSomePrefixPetCategory';
import {
SomePrefixPetCategoryFromJSON,
SomePrefixPetCategoryFromJSONTyped,
SomePrefixPetCategoryToJSON,
} from './SomePrefixSomePrefixPetCategory';
I.e. SomePrefix is added twice.
openapi-generator version
Issue started in version 7.6.0 and is still there in current master.
Version 7.5.0 is working fine.
OpenAPI declaration file content or url
It can be reproduced using modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml from the repo:
https://github.com/OpenAPITools/openapi-generator/blob/v7.6.0/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml
Generation Details
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml \
-g typescript-fetch \
--additional-properties modelNamePrefix=SomePrefix \
-o generator_out/
Steps to reproduce
See command above
Related issues/PRs
Nothing found.
Suggest a fix
It's probably due to this PR which touched a bit of relevant code between 7.5.0 and 7.6.0: #18284
Bug Report Checklist
Description
When generating the model files the prefix is properly added once in front of the generated files. However, in the import statements the prefix is added twice resulting in erroneous statements breaking the build.
When e.g.
SomePrefixis set formodelNamePrefix, then the following model files are generated forexample-for-file-naming-option.yaml:SomePrefixPetCategory.tsSomePrefixPet.tsHowever, within
SomePrefixPet.tsit looks like this:I.e.
SomePrefixis added twice.openapi-generator version
Issue started in version
7.6.0and is still there in currentmaster.Version
7.5.0is working fine.OpenAPI declaration file content or url
It can be reproduced using
modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yamlfrom the repo:https://github.com/OpenAPITools/openapi-generator/blob/v7.6.0/modules/openapi-generator/src/test/resources/3_0/typescript-fetch/example-for-file-naming-option.yaml
Generation Details
Steps to reproduce
See command above
Related issues/PRs
Nothing found.
Suggest a fix
It's probably due to this PR which touched a bit of relevant code between 7.5.0 and 7.6.0: #18284