OpenAPITools / OpenAPITools/openapi-diff
[Bug] Backward compatibility check fails on reordered discriminator mappings
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 1.1k
- フォーク
- 190
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Ran into a compatibility issue, which I believe is a false positive. I have one polymorphic schema, that maps to two different property names. The backwards compatibility check fails if the mappings are re-ordered.
This should not be failing, because neither discriminator names nor the mapping changed.
For example, the following 2 should be considered compatible, but are not. Assume the actual schemas are identical. Schema A is mapped to a-type and z-type which are present in both mappings, but are ordered differently.
schema:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
discriminator:
propertyName: realtype
mapping:
z-type: '#/components/schemas/A'
a-type: '#/components/schemas/A'
b-type: '#/components/schemas/B'
and
schema:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
discriminator:
propertyName: realtype
mapping:
a-type: '#/components/schemas/A'
z-type: '#/components/schemas/A'
b-type: '#/components/schemas/B'
I was able to reproduce this in this repo by adding a test to OneOfDiffTest with the above as an example (based on oneOf_discriminator-missing_1.yaml).
@Test
public void testOneOfDiscrimitatorDifferentOrder() {
assertOpenApiAreEquals(OPENAPI_DOC11, OPENAPI_DOC12);
}
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
既存の OneOfDiffTest と、issue で言及されている oneOf_discriminator-missing_1.yaml の例から始めます。マッピングを並べ替えたケースを追加または実行し、そのケースが通る比較のエントリポイントを追跡します。2 つの示されたスキーマが、discriminator マッピングの順序だけが異なる場合に互換として扱われれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- api
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100