cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Allow generating an array with all enum model items #303

Closed luisfpg closed 11 months ago

luisfpg commented 11 months ago

This is specially useful when using enumStyle is alias. In this case it is not possible to iterate over all enum items, as they only exist at compilation time. However, in some particular cases this is useful. So, the idea is to add a new boolean option enumArray (default false) to generate a ts file next to the enum file, suffixed with -array.ts, which exports a const with all enum items in an array. This file isn't even included in the model index (models.ts). This way the overhead on generated code is minimal, and will only include arrays of actually used enums.