openapi-generator-cli icon indicating copy to clipboard operation
openapi-generator-cli copied to clipboard

Allow direct CLI invocations to use similar code to GeneratorService.cmd()

Open t3rmin4t0r opened this issue 2 months ago • 1 comments

This makes PassThroughService.cmd() pass a --user command similarly to GeneratorService.cmd()

https://github.com/OpenAPITools/openapi-generator-cli/blob/cd66bf17a758a5171b2a35bdf45805ca47b7d5cc/apps/generator-cli/src/app/services/generator.service.ts#L232

In my build environment, this fixes file ownership issues when using direct CLI invocations with Docker.

The index.ts written by the CLI generator is owned by root user, when using

pnpm openapi-generator-cli generate -g typescript-fetch -o /local/output -i /local/input.json

The current workaround is to write it into the openapitools.json as a generator and do

pnpm openapi-generator-cli generate --generator-key typescript-api

which takes the code path which passes in --user and therefore produces user owned output files.

t3rmin4t0r avatar Oct 25 '25 05:10 t3rmin4t0r

thanks for the PR

would it be possible to add a test or 2 covering this change?

wing328 avatar Nov 20 '25 08:11 wing328