cyclosproject / ng-openapi-gen

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

enumStyle option has no effect #273

Closed gwesterman closed 1 year ago

gwesterman commented 1 year ago

Using v0.24.1, no matter what value for enumStyle I use ("alias", "upper", "pascal", "ignorecase") the following schema:

"status":{
   "type":"string",
   "enum":[
      "ACTIVE",
      "INACTIVE",
      "SUSPENDED",
      "BANNED",
      "DELETED"
   ]
}

always results in the following generated output:

status?: 'ACTIVE' | 'INACTIVE' | 'SUSPENDED' | 'BANNED' | 'DELETED';

Note: It also does not default to "pascal" but to "upper".

I'd also much rather prefer an actual enum to be generated which I can then use in my code.

luisfpg commented 1 year ago

The enumStyle option is only used for models defined as enums, not for nested property declarations, which are always declared as an inline type. this has been proposed before, but is out of scope, because it would require the model to export additional enums, which complicates generation.