Typescript-fetch incompatibility: duplicate exports
eettaa opened this issue · 1 comments
When using OpenAPIGenerator* and this swagger.yaml file to generate a typescript-fetch sdk, the generated sdk will not compile because of the following errors:
> npx tsc --listEmittedFiles
yodlee/yodlee-api/models/index.ts:155:1 - error TS2308: Module './Transaction' has already exported a member named 'TransactionCategorySourceEnum'. Consider explicitly re-exporting to resolve the ambiguity.
155 export * from './TransactionCategory';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yodlee/yodlee-api/models/index.ts:155:1 - error TS2308: Module './Transaction' has already exported a member named 'TransactionCategoryTypeEnum'. Consider explicitly re-exporting to resolve the ambiguity.
155 export * from './TransactionCategory';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is because in swagger.yaml Transaction is defined as an object with enum 'categoryType' and TransactionCategory is defined as an object with enum 'type'. Values for these fields are both codegen'ed into TransactionCategoryTypeEnum, leading to a naming conflict. (same goes for source).
Coincidentally, these enums contain the same values, meaning there is no runtime problem at present. However, I'm not sure whether this is guaranteed to remain the case.
To the extent that these enums will remain the same, can they be refactored into a new definition and/or can exporting guidance be updated? (For example, maybe the fix is to manually edit index.ts
to arbitrarily pick one of the identical definitions?
To the extent that they are not guaranteed to be the same, can they be renamed such that they do not conflict?
Thanks!
*I did first try to use Swagger.io and even Swagger-codegen to generate my SDK's per yodlee's guidance but ran into worse problems than this- that repo is much less maintained.
FWIW there is a similar flavor of issue for typescript-axios