Openapi-generator: [BUG][typescript/angular] Configuration collision with api

Created on 3 Jun 2019  路  4Comments  路  Source: OpenAPITools/openapi-generator

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.

Bug

All 4 comments

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

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 please open a new issue an specify the version, command etc. you are using.

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

Was this page helpful?
0 / 5 - 0 ratings