6

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?

Helen
  • 87,344
  • 17
  • 243
  • 314
Mattieeec3
  • 114
  • 3
  • 8
  • 1
    I have the same issue, this seems to have to do with the angular typescript generator as the underlying JSON is OpenAPI v3 + it actually defines it as an enum. Although the JSON does not define any semantic labels... Not sure how to fix this. – rumblefx0 Jan 22 '21 at 10:11

1 Answers1

3

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

Tozo
  • 63
  • 7