openapi-generator-cli: [BUG] "Required option '-i' is missing"
š Bug Report:
Describe the bug
When I run npx openapi-generator-cli generate, I get the following error:
$ npx openapi-generator-cli genera
[error] Required option '-i' is missing
Steps to Reproduce
Iām on v 2.5.2 (latest at time of writing), Cygwin on Windows, Node 14. Hereās all relevant info I can think of:
$ npx --version
6.14.17
$ npm --version
6.14.17
$ node --version
v14.20.0
$ npx openapi-generator-cli version
6.0.1
$ grep openapi-generator ../../package.json
"@openapitools/openapi-generator-cli": "^2.5.2",
$ cat openapitools.json
{
"$schema": "../../node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.0.0",
"generators": {
"my-spec-gen": {
"generatorName": "typescript-rxjs",
"output": "./generated",
"inputSpec": "./reference/my-spec.yaml"
}
}
}
}
$ npx openapi-generator-cli generate
Download 6.0.1 ...
Downloaded 6.0.1
[error] Required option '-i' is missing
Expected behavior
openapi-generator-cli should invoke openapi-generator-cli with correct args in order to regenerate my models
Operation System (please complete the following information):
- OS: Windows 10, Cygwin
Package System (please complete the following information):
npm 6.14.17, node v14.20.0
I get the same on Node 18
Additional context
This appears to be the same issue described in #43 that is marked fixed.
I was able to work around by invoking Java directly:
java -jar ../../node_modules/@openapitools/openapi-generator-cli/versions/6.0.1.jar generate -i ./reference/my-api.yaml -o generated -g typescript-rxjs
I canāt see whatās up with openapi-generator-cli or how to diagnose further. I wasnāt able to get any diagnostic logs, and the main.js seems minified so I couldnāt investigate further.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 13
- Comments: 16 (4 by maintainers)
Can confirm it still happens on 7.4.0
@wing328 itās not fixed in 7.3.0, just tried that out.
To get the issue back on track: The problem is not that ā-i is missingā, but that the
openapitools.jsonis simply ignored when runningopenapi-generator-cli generate --generator-key v1.0. (oropenapi-generator-cli generate)Im pretty sure of this, because when i specify -i manually the cmd complains about generator name as so on⦠even tho they are all defined in the json.
I can confirm the bug, after a fresh install of
@openapitools/openapi-generator-cli": "^2.7.0"in the package.json and invoking it throughnpm runin a linux github codespace. Also theopenapitools.jsonis overwritten for me.Installing it globally and using only the command line options worked for me (as a workaround)