acacode/swagger-typescript-api

[Bug] 12.0.4 Parser option --extract-enums fails to generate with prettier linting error to generate

MiracleUFO opened this issue · 1 comments

Command: npx swagger-typescript-api@12.0.4 -p .dev-helper/openapi.yml -o $target_folder -n index.ts --union-enums --extract-enums

Generating types with options --union-enums --extract-enums throws this error and TS file is not generated for a specific openapi.yml file. I cannot remove --extract-enums as it's part of our configuration for the whole app.

I believe a terminating semicolon is not added by swagger-typescript-api@12.0.4 causing this error to be thrown it attempts when format with prettier:

SyntaxError: ';' expected. (1604:10)
  1602 |  * @example "payout_interest"
  1603 |  */
> 1604 |   export type DepositInterestTreatment = "capitalize_interest" | "payout_interest"
       |          ^
  1605 |
  1606 |   /**
  1607 |  * Current state of the deposit.
    at Ve (~/.npm/_npx/40e7642a532d5314/node_modules/prettier/parser-typescript.js:1:15607)
    at vz (~/.npm/_npx/40e7642a532d5314/node_modules/prettier/parser-typescript.js:280:5919)
    at Object.yz [as parse] ~/.npm/_npx/40e7642a532d5314/node_modules/prettier/parser-typescript.js:280:6242)

Related to Issue

I do not want to upgrade to ^13.0.0 because when I used it last I got a circular dependency error and had to downgrade.