cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
404 stars 134 forks source link

inline enums inside models are generated without enum type #137

Open bhawna85 opened 3 years ago

bhawna85 commented 3 years ago

Its generated as : export interface StatusModel status?: 'APPROVED' | 'INELIGIBLE' | 'PENDING'; }

should be generated as: export interface StatusModel{ status?: StatusModel.StatusEnum; export type StatusEnum = 'APPROVED' | 'INELIGIBLE' | 'PENDING' ; export const StatusEnum = { APPROVED: 'APPROVED' as StatusEnum, INELIGIBLE: 'INELIGIBLE' as StatusEnum, PENDING: 'PENDING' as StatusEnum }; }

luisfpg commented 3 years ago

It has always been generated like that for inline. A workaround is to move the enum to a top-level model. I wouldn't have time for now to implement such feature. Help is welcome.

JamesPeters98 commented 3 years ago

Is there any chance this will get looked at?

Currently it means working with enums is pretty ugly on the typescript side