openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][typescript/angular] Configuration collision with api

Open draco2007 opened this issue 7 years ago • 4 comments

Description

We have an API which defines a "Configuration" model. So the API generator generates an interface "Configuration" and exports this model in the "model.ts" via "export * from "./configuration". This collides with the "index.ts" where the "Configuration" class is also exported via "export * from "./configuration".

openapi-generator version

Version 4.0.0

Suggest a fix

My current solution for this is adding a model-suffix, which renames the "Configuration" model interface to "ConfigurationModel". But I find it rather ugly. I would prefer an prefixed name for the generated "Configuration" class.

draco2007 avatar Jun 03 '19 12:06 draco2007

@draco2007 this is rather a general issue, as there will always be naming collisions. However, your model-suffix should indeed resolve the issue.

macjohnny avatar Jun 03 '19 12:06 macjohnny

I have an issue when I add prefix and then generated imports are wrong. For example I provide --model-name-prefix abc And then generated import as import { AbcResponseStateType } from './abcAbcResponseStateType';

So in the file name prefix is duplicated and file name is abcResponseStateType.ts (without prefix its import { ResponseStateType } from './ResponseStateType'; Have somebody seen this behavior?

anton-lebodkin avatar Jul 23 '19 09:07 anton-lebodkin

@anton-lebodkin please open a new issue an specify the version, command etc. you are using.

macjohnny avatar Jul 23 '19 09:07 macjohnny

@macjohnny Excuse me, occasionally runned swagger-codegen. openapi-generator is ok

anton-lebodkin avatar Jul 23 '19 09:07 anton-lebodkin