Skip to content

Conversation

@teovillanueva
Copy link

Add the possibility to disable output formatting. The motivations to add this configuration are the following:

  • Codegen output is not usually commited to git and some projects use other formatting tools (ex. biomejs)
  • The following error I couldn't fix 🤣
Syntax Error: Unexpected token, expected "," (10:10)
   8 |      * @example Invalid request parameters
   9 |      */
> 10 |     error?: string;
     |          ^
  11 |     /**
  12 |      * @example 400
  13 |      */
   8 |      * @example Invalid request parameters
   9 |      */
> 10 |     error?: string;
     |          ^
  11 |     /**
  12 |      * @example 400
  13 |      */
    at pa (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/plugins/babel.mjs:14:16245)
    at ua (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/plugins/babel.mjs:14:16680)
    at Object.parse (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/plugins/babel.mjs:15:2919)
    at parse5 (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/index.mjs:16731:24)
    at async coreFormat (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/index.mjs:17287:25)
    at async formatWithCursor (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/index.mjs:17504:14)
    at async Object.format2 (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/prettier@3.6.2/node_modules/prettier/index.mjs:19051:25)
    at async Object.writeFile2 [as writeFile] (file:///Users/teovillanueva/Desktop/typend/node_modules/.pnpm/@openapi-codegen+cli@3.1.0/node_modules/@openapi-codegen/cli/lib/cli.js:380:35)
    at async generateSchemaTypes (/Users/teovillanueva/Desktop/typend/node_modules/.pnpm/@openapi-codegen+typescript@11.1.0/node_modules/@openapi-codegen/typescript/lib/generators/generateSchemaTypes.js:97:13)
    at async Object.to (file:///Users/teovillanueva/Desktop/typend/packages/api-hooks/openapi-codegen.config.mjs:12:38)

@fabien0102
Copy link
Owner

Thanks for the contribution, but I think we can go further, let’s remove prettier from the pipeline. The latest version (this one is not up-to-date) has some problems to grab the proper config and it’s easy enough to add prettier as second step command.

I did a simple guide for my other project that you can take inspiration -> https://github.com/fabien0102/ts-to-zod?tab=readme-ov-file#prettifying-the-generated-files, I think it’s nice to help people that still want this feature

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

Successfully merging this pull request may close these issues.

2 participants