Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger-codegen not generating enums as enum type

I have an enum in my swagger scheme which looks like the following:

- name: shipmentType
      in: query
      required: false
      type: integer
      format: int32
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6

After generating the typescript-angular client with swagger codegen (2.4.17), the generated enum looks like the following picture:

enter image description here

is there any way to make the generator use the typescript enum type instead of creating a custom object?

like image 479
Mattieeec3 Avatar asked Aug 12 '26 13:08

Mattieeec3


1 Answers

It seems once I set stringEnums to true in the openapi-generator, it actually generates enums and not type

like image 96
Tozo Avatar answered Aug 14 '26 20:08

Tozo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!