microsoft / microsoft/OpenAPI.NET.OData

When EnableDiscriminatorValue is set to true all types end up with a required property of odata.type

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

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

主要言語
C#
スター
240
フォーク
70
平均マージ
7時間 59分
マージ済み PR(30日)
13

説明

My understanding is odata.type is only required in the case the type cannot be determined such as it being a type derived from the specified type.

When using EnableDiscriminatorValue = true I get correctly odata.type used as a discriminator when a type has a derived type.
I also get however for seemingly all types, odata.type included as a required property.

Assemblies affected

v1.1.0

Steps to reproduce
  1. Create an odata model with no derived types.
  2. Generate an Open API specification from the model with EnableDiscriminatorValue = true.
Expected result

I would only expect odata.type to be required in the case a type is a derived type.

Actual result

odata.type is set as required for all types.

If I use Open API connected services in Visual Studio with the specification to generate a client, the client will fail to deserialize responses missing the required property by default.

Additional detail

This can be worked around in most case.

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

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

はじめの一歩

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

調査の方向性

派生型を持たず、EnableDiscriminatorValue が true に設定された OData モデルで問題を再現することから始め、その後、生成された OpenAPI 仕様を調べます。ディスクリミネーターのメタデータが必須プロパティになる過程を追跡します。完了の条件は、派生型によって必要になる場合にのみ odata.type が必須となり、有効なクライアントのデシリアライズを壊さないことです。

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

評価

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

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

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