Open JanMalch opened 2 years ago
The generator crashes with the [error] Required option '-i' is missing error when running with different cwd.
[error] Required option '-i' is missing
Steps to reproduce the behavior:
packages/client
packages/server
packages/openapi.yaml
packages/client/openapitools.json
"inputSpec": "../openapi.yaml"
"openapi": "openapi-generator-cli generate"
"openapi": "npm run openapi --workspaces --if-present"
openapitools.json
I created a packages/client/openapi.js script and let it run in client via "openapi": "node openapi.js" , but this also fails in the same way.
packages/client/openapi.js
"openapi": "node openapi.js"
// try forcing the cwd to the client directory (works when checking with pwd command) const child = require('child_process').exec('openapi-generator-cli generate', { cwd: __dirname }); child.stdout.pipe(process.stdout); child.stderr.pipe(process.stderr); child.on('exit', code => process.exit(code));
I expect the generator to always find the file.
It works when using npx in the client script: "openapi": "npx openapi-generator-cli generate".
npx
"openapi": "npx openapi-generator-cli generate"
🐛 Bug Report:
Describe the bug
The generator crashes with the
[error] Required option '-i' is missing
error when running with different cwd.Steps to Reproduce
Steps to reproduce the behavior:
packages/client
andpackages/server
(server probably isn't even necessary)packages/openapi.yaml
packages/client/openapitools.json
via"inputSpec": "../openapi.yaml"
"openapi": "openapi-generator-cli generate"
and run it"openapi": "npm run openapi --workspaces --if-present"
and run itopenapitools.json
in the root directoryFailing workaround
I created a
packages/client/openapi.js
script and let it run in client via"openapi": "node openapi.js"
, but this also fails in the same way.Expected behavior
I expect the generator to always find the file.
Operation System:
Package System: