Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG] Error when working with npm workspaces

オープン
#605 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@kay-schecker がすでに取り組んでいます。

2022年1月30日 から。

評価

この issue はまだ評価されていません。

説明

bug

🐛 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:

  1. Create a npm project with two workspaces: packages/client and packages/server (server probably isn't even necessary)
  2. Save a spec in packages/openapi.yaml
  3. Reference it in packages/client/openapitools.json via "inputSpec": "../openapi.yaml"
  4. Add a script in client: "openapi": "openapi-generator-cli generate" and run it
    • It works ✔️
  5. Add a script in root "openapi": "npm run openapi --workspaces --if-present" and run it
    • See error ❌
    • Generates a openapitools.json in the root directory
Failing 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.

// 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));
Expected behavior

I expect the generator to always find the file.

Operation System:
  • OS: Windows
  • Version 10
Package System:
  • npm v8.3.0
主要言語
TypeScript
スター
2k
フォーク
208
平均マージ
7時間 12分
マージ済み PR(30日)
6

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenAPITools/openapi-generator-cli のほかの issue

OpenAPITools/openapi-generator-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。