Repository navigation
Open
Labels
bugSomething isn't workingSomething isn't working
Description
🐛 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.
Reacted by Fiete, Luke Frisken, Christopher Milde, Marc Pacheco García, Clovis Durand, DanielHabenicht, Rob Resendez, so/ふかねこ, hennihaus, Roman Zabaluev and 5 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
DanielHabenicht commentedon Oct 14, 2023
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 the
openapitools.jsonis overwritten for me.Installing it globally and using only the command line options worked for me (as a workaround)
a-stangl commentedon Dec 4, 2023
I had the same issue while trying to run
generatewithout arguments from within a subfolder of my project. I “fixed” it by putting myopenapitools.jsonin the project root (the same level as mypackage.json) and adjusting my paths (inputSpec,output,config, etc.) relative to the project root.After invoking the generator via a NPM script from my
package.json, e.g.via
npm run generateall worked as expected.RobinMeow commentedon Dec 10, 2023
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.
RichardBradley commentedon Feb 8, 2024
This seems to have been fixed in the latest version.
It's no longer happening for me at any rate
wing328 commentedon Feb 8, 2024
thanks for the confirmation
just so you know we just released openapi-generator v7.3.0
Haarolean commentedon Feb 9, 2024
Experiencing this as well. Only on Windows.
provectus/kafka-ui#1582
Haarolean commentedon Feb 9, 2024
@wing328 it's not fixed in 7.3.0, just tried that out.
tajnymag commentedon Mar 11, 2024
Can confirm it still happens on 7.4.0
wing328 commentedon Mar 11, 2024
are you guys using Windows? are you using DOS prompt?
it works for me on Windows 11, JDK17 with DOS command prompt.
tajnymag commentedon Mar 11, 2024
Running both Windows 11 and JDK17.
Can reproduce in conhost too, but I mainly use pwsh in Windows Terminal. That doesn't seem to be the issue.
I'm probably in a wrong issue though, my issue is mainly related to this issue: #43.
I'm using pnpm and I'm calling the generator from a package.json script.
tajnymag commentedon Mar 11, 2024
Found the issue. At least in my case.
Openapi-generator-cli is using INIT_CWD as its working directory:
openapi-generator-cli/apps/generator-cli/src/app/services/config.service.ts
Line 10 in 7e43a4e
When I ran my pnpm test script from a different directory (
pnpm -rorpnpm run --dir) I got:There's an issue in pnpm discussing where INIT_CWD is supposed to point.
wing328 commentedon Mar 12, 2024
thanks for sharing the details.
as a workaround, please use npm instead.
wilml commentedon Mar 19, 2024
Hi @wing328 using npm (assuming below is what you meant) does not work. I tried the following,
And then ran,
Still same error,
Edit: Using version 7.4.0 on Ubuntu 22.04
wing328 commentedon Mar 20, 2024
the latest version of the npm wrapper allows you to specify the openapitools.json file. can you please give it a try?
#754
wilml commentedon Mar 20, 2024
Hi @wing328 thanks for the follow up. After much debugging I discovered that the same error is given if the
openapitools.jsonfile does not follow the openapi-generator-cli schema (I didn't have the generators within thegeneratorobject).Its now working as expected on the latest release.
lpinto-adn commentedon Mar 25, 2024
Hello @wing328,
My situation is similar to the one described on #690 (comment)
The difference is that in my windows environment the process.env.PWD is filled but it has the wrong project path, as showed below
I'm using npm to run "openapi-generator-cli generate" command
I found this comment #758 (comment), and I believe it could solve my situation.
Has a workaround I have to define all the configurations like this
"openapi-generator-cli generate -i xx -g xxx -o xxx -c openapitools.json", but this way I am repeating the settings that exist within the openapitools.json file.segevfiner commentedon Sep 24, 2024
I think openapi-generator-cli should really just use
process.cwd()... With INIT_CWD it seems to often gen invoked in the current directory even when running scripts recursively from a different folder. AndPWDis essentiallyprocess.cwd()on Linux/macOS, but doesn't exist in Windows, which causes the behavior to vary...PawelWesolowski commentedon Feb 11, 2025
I just got it because there was a formatting error in my config json file. Just FYI...
jacolineeckard07-tech commentedon Aug 10, 2026
I don't know of access was and is manipulated by cast or Bluetooth and or Network Wifi.

Maybe you can figure it out please
jacolineeckard07-tech commentedon Aug 10, 2026
jacolineeckard07-tech commentedon Aug 10, 2026
These are the apps on my phone and halve of it I don't know