Comments (13)
We have the same issue with pnpm
. It happens when we invoke openapi-generator-cli
(version 6.3.0) via pnpm
(version 7.27.0) with the --dir
flag from outside the project's root folder i.e.:
pnpm --dir <path to the projects root folder> run generate-sources
generate-sources
in turn is defined as follows in the respective package.json
's script section:
"generate-sources": "openapi-generator-cli generate"
The generation of types runs as part of the CI on windows, mac and linux. It only fails on windows. Furthermore it didn't cause any problems when used in conjunction with yarn
and only appeared after switching to pnpm. The workaround for us is to change into the project directory and execute pnpm without --dir. It's worth noting that we have a bunch of different scripts all executed with --dir
and they work flawlessly across all systems so this is likely an issue that pertains to openapi-generator-cli
and not to pnpm
.
from openapi-generator-cli.
I guess it's an issue with the current cwd. I'll fix it asap
from openapi-generator-cli.
which OS, Node and NPM you are using?
from openapi-generator-cli.
- npm:
6.14.8
- node:
14.12.0
/14.13.0
(also present with the newest version) - os:
macOS 10.15.7
edit: running npm with --verbose
shows that CWD
points to the project root where the openapitools.json
is located in.
from openapi-generator-cli.
fixed with v2.0.3
from openapi-generator-cli.
The error still appears with version 2.0.3. At least for me. Minimal example (tested on macOS, arch linux and windows):
cli_example.zip
- run
npm install
to install openapi-generator-cli version 2.0.3 - run
npm run generate:openapi
from openapi-generator-cli.
Thanks, I'll check
from openapi-generator-cli.
You missed the generators node:
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "5.0.0-beta2",
"generators": {
"project-ts": {
"generatorName": "typescript-axios",
"output": "#{cwd}/src/api/#{name}",
"glob": ".apiSchema/swagger/*.json"
}
}
}
}
from openapi-generator-cli.
I'll add a new feature to validate the given config ...
from openapi-generator-cli.
Yes, sorry I should have noticed.
from openapi-generator-cli.
I still get this error on the latest version.
Is there a workaround? I can't even figure out how to get this tool to print what Java command it is invoking so I can work around.
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
Any ideas what I can do to diagnose or fix?
from openapi-generator-cli.
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
.. still not sure 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.
from openapi-generator-cli.
Found the issue!
Openapi-generator-cli is using INIT_CWD as its working directory:
When I ran my pnpm test script from a different directory (pnpm -r
or pnpm run --dir
) I got:
> node cwd-test.js
process.env.PWD undefined
process.env.INIT_CWD C:\Users\marek\GitHub\vsb-eink-services
process.cwd() C:\Users\marek\GitHub\vsb-eink-services\packages\facade-api-client
There's an issue in pnpm discussing where INIT_CWD is supposed to point.
from openapi-generator-cli.
Related Issues (20)
- [BUG]
- [BUG] - How to generate code for specific tag/path? specifying `--globalProperty=apis=user` is not working.
- [BUG] Unable to query repository becasuse of: "Socket connection timeout" in MacOS HOT 2
- Rename default service generate
- Failed to run the command for setting the version `openapi-generator-cli version-manager set 5.3.0`
- [BUG] HTTP_PROXY Support No Longer Works HOT 6
- [BUG] Axios package <1.6.0 vulnerability HOT 3
- [BUG] useDocker is not passing the user and group when running through the passthrough service HOT 1
- [BUG] version-manager doesn't work since search.maven.org redirects to central.sonatype.com HOT 2
- [BUG] axios version lesser than 1.6.0 has Cross-Site Request Forgery vulnerability HOT 20
- [UPDATE] Release 7.1.0 HOT 4
- [BUG] cant run docker-entrypoint.sh anymore | bash missing :( HOT 2
- [BUG] openapi-generator-cli throw java runtime error in any directory, except installed project HOT 2
- openapi-generator-cli 7.1.0 has errno: -9, code: EBADF [BUG]
- Commercial issues
- [BUG] Version manager sets different version in different folders in Docker
- [BUG] Issue with TypeScript type generation for multiple status codes
- openapi-generator-cli couldn't list installed versions HOT 6
- [BUG] - Generation Error in V.2.10.0 HOT 15
- Cannot read propertie of undefined (reading 'action') HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-generator-cli.