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

inverseOperationIds removes schema properties named after HTTP methods (e.g. head)

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript
領域
api, tooling

調査の方向性

「Inverse operationIds without operationIds」ステップの openapiFilter ロジックから開始し、提供された OpenAPI ドキュメントで問題を再現します。paths 配下のキーに使用されている走査の深さを確認し、その後、createPull のフィルタリングによってスキーマプロパティ head、base、get が保持される一方で、対象の操作が削除されることを検証します。詳細

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

説明

bug

inverseOperationIds removes schema properties whose names are HTTP methods (head, get, post, …) when those properties are in inline schemas under paths, such as request bodies. The operation itself is kept, but it loses the properties.

This hit a real API: GitHub's "create a pull request" request body has a required head property, and inverseOperationIds: ['pulls/create'] strips it.

Reproduction (openapi-format 1.33.7, Node 24):

import { openapiFilter } from 'openapi-format';

const doc = {
  openapi: '3.0.3',
  info: { title: 't', version: '1' },
  paths: {
    '/pulls': {
      post: {
        operationId: 'createPull',
        requestBody: {
          content: {
            'application/json': {
              schema: {
                type: 'object',
                properties: {
                  head: { type: 'string' },
                  base: { type: 'string' },
                  get: { type: 'string' },
                },
              },
            },
          },
        },
        responses: { 201: { description: 'Created' } },
      },
    },
  },
};

const { data } = await openapiFilter(doc, {
  filterSet: { inverseOperationIds: ['createPull'] },
});
console.log(
  Object.keys(data.paths['/pulls'].post.requestBody.content['application/json'].schema.properties),
);

Expected: [ 'head', 'base', 'get' ]
Actual: [ 'base' ]

With filterSet: {} or { unusedComponents: ['schemas'] }, all three properties are kept.

Likely cause: in openapiFilter, the "Inverse operationIds without operationIds" step removes any node under paths whose key is in httpVerbs and that has no operationId:

inverseFilterProps.length > 0 &&
  this.path[0] === 'paths' &&
  node.operationId === undefined &&
  httpVerbs.includes(this.key)

It doesn't check depth, so it also matches schema properties inside operations. Restricting it to operation objects (for example this.path.length === 3, which is paths → path → method) should fix it.

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

環境構築

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

はじめの一歩

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

thim81/openapi-format のほかの issue

thim81/openapi-format の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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