Filter unused OpenAPI definitions when extracting selected operations

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

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
openapi, typescript
領域
cli, tooling

調査の方向性

Start at the apiops extract command in the TypeScript CLI source and trace where the --filter operation selection prunes paths before the spec is written to specification.yaml. The fix belongs after paths are filtered: collect the $ref targets reachable from the remaining operations and keep only those components/definitions, walking transitively so shared schemas and nested items survive. Validate with an extracted spec containing an invalid definition used only by an excluded operation, then run it through Spectral — done means Spectral no longer reports errors from unreferenced definitions.

索引モデルが issue の本文から書いたものです。

説明

type:bug
Command that triggered the bug

apiops extract

Expected behavior

When extracting an API with an operation filter, the generated OpenAPI specification contains only the selected operations, but retains definitions used exclusively by excluded operations.

This can cause validation to fail on an unrelated definition. For example, Spectral reports an array-items error for an invalid schema even when the operation using it was excluded.

Expected behavior

Filter the definitions to those needed by the selected operations, while preserving all transitively referenced components.

Actual behavior

The extractor removes unselected operations from specification.yaml, but still extracts definitions that are not referenced by the selected operations. As a result, validation can fail on an invalid definition unrelated to the selected operations.

apiops CLI version

1.0.5

Environment details

Environment

APIOps CLI: 1.0.5
Command: apiops extract --filter
CI: Azure DevOps with Spectral validation

CI/CD environment

None

Is this bug blocking you?

Yes

主要言語
TypeScript
スター
44
フォーク
14
PR マージ指標
30日以内にマージされた PR はありません

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

Azure/apiops-cli のほかの issue

Azure/apiops-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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