flowup / api-client-generator

Angular REST API client generator from Swagger YAML or JSON file with camel case settigs
MIT License
115 stars 21 forks source link

Enum key substitution of disallowed characters #74

Closed stephenwil closed 5 years ago

stephenwil commented 5 years ago

Swagger has:

  "enum": [
        "Business",
        "Personal",
        "School",
        "Alternate 1",
        "Alternate 2",
        "Alternate 3",
        "Alternate 4"
      ]

But generated typescript enum key values aren't valid:

export enum EmailType {
  Business = "Business",
  Personal = "Personal",
  School = "School",
  Alternate 1 = "Alternate 1",
  Alternate 2 = "Alternate 2",
  Alternate 3 = "Alternate 3",
  Alternate 4 = "Alternate 4",
vmasek commented 5 years ago

Thanks for a bug report, we need to substitute whitespaces with an underscore.

I'll try to fix it with other things this week. If it is blocking, just edit the generated enum and add an underscore, it will be like that in the next release.