Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MiracleUFO opened this issue Aug 27, 2024 · 2 comments

Comments

@MiracleUFO
Copy link

MiracleUFO commented Aug 27, 2024

Command: npx [email protected] -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)
@MiracleUFO MiracleUFO changed the title [Bug] Parser option --extract-enums fails to generate due to linting error in version 12.0.4 [Bug] v 12.0.4 Parser option --extract-enums fails to generate with prettier linting error to generate Aug 27, 2024
@MiracleUFO
Copy link
Author

MiracleUFO commented Aug 27, 2024

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.

@MiracleUFO MiracleUFO changed the title [Bug] v 12.0.4 Parser option --extract-enums fails to generate with prettier linting error to generate [Bug] 12.0.4 Parser option --extract-enums fails to generate with prettier linting error to generate Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@MiracleUFO and others