OpenAPITools / OpenAPITools/openapi-diff

ChangedSchema in a readOnly property for requestBody is not filtered out from the result.

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

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

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

説明

Old API
{
  "openapi":"3.0.0",
  "info":{
    "title":"API",
    "version":"0.1.0"
  },
  "paths":{
    "/resource":{
      "post":{
        "responses":{
          "200":{
            "description":"Created resource",
            "content":{
              "application/json":{
                "schema":{
                  "$ref":"#/components/schemas/CreateResourceResponse"
                }
              }
            }
          }
        },
        "summary":"Create resource",
        "requestBody":{
          "content":{
            "application/json":{
              "schema":{
                "$ref":"#/components/schemas/CreateResourceRequest"
              }
            }
          },
          "description":"Definition of the resource"
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateResourceResponse": {
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateResourceRequest": {
        "type": "object",
        "properties": {
          "foo": {
            "$ref": "#/components/schemas/Foo"
          }
        }
      },
      "Foo": {
        "type": "object",
        "properties": {
          "bar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bar"
            },
            "readOnly": true
          }
        }
      },
      "Bar": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        }
      }
    }
  }
}
New API
{
  "openapi":"3.0.0",
  "info":{
    "title":"API",
    "version":"0.1.0"
  },
  "paths":{
    "/resource":{
      "post":{
        "responses":{
          "200":{
            "description":"Created resource",
            "content":{
              "application/json":{
                "schema":{
                  "$ref":"#/components/schemas/CreateResourceResponse"
                }
              }
            }
          }
        },
        "summary":"Create resource",
        "requestBody":{
          "content":{
            "application/json":{
              "schema":{
                "$ref":"#/components/schemas/CreateResourceRequest"
              }
            }
          },
          "description":"Definition of the resource"
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateResourceResponse": {
        "type": "object",
        "properties": {
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "CreateResourceRequest": {
        "type": "object",
        "properties": {
          "foo": {
            "$ref": "#/components/schemas/Foo"
          }
        }
      },
      "Foo": {
        "type": "object",
        "properties": {
          "bar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bar"
            },
            "readOnly": true
          }
        }
      },
      "Bar": {
        "type": "object",
        "properties": {
          "name": {
            "type": "integer"
          }
        }
      }
    }
  }
}

In this example, the property bar in Foo schema is a readOnly property and Foo is referenced by request body of the endpoint.
When Bar schema is changed, it's filtered out from the request body but the change exists in the list of ChangedSchema in ChangedOpenApi, which results incompatible changes but shows nothing.

==========================================================================
==                            API CHANGE LOG                            ==
==========================================================================
                                   API                                    
--------------------------------------------------------------------------
--                                Result                                --
--------------------------------------------------------------------------
                 API changes broke backward compatibility                 
--------------------------------------------------------------------------

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

まず Old API と New API の例で問題を再現し、リクエストボディの readOnly bar プロパティに対する ChangedSchema と ChangedOpenApi の結果に焦点を当てます。変更された Bar スキーマがリクエストボディの互換性チェックから除外される一方で ChangedSchema には残る経路を追跡します。完了条件は、結果として得られる変更リストと互換性出力に、その除外された変更が報告されなくなることです。

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

評価

技術スタック
java
領域
api, backend-api-design
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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