microsoft / microsoft/OpenAPI.NET.OData

Post/Patch/Delete Paths not generated for type casts

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

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

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

説明

When generating an OpenAPI specification of the OData model, it does not generate the post/patch/delete paths for the type cast entities. In my example (see below) CreateJiraIssue is derived from Widget. But it does not generate the paths for post/patch/delete

image

OData supports post/patch/delete for the cast types! It works when you do an patch request to the correct url. It is also described here:
https://learn.microsoft.com/en-us/odata/webapi-8/fundamentals/entity-routing?tabs=net60%2Cvisual-studio

Assemblies affected

Microsoft.OpenApi.OData (1.6.3)

Steps to reproduce

Create a class A and a derived class B. Add class A as entity set to the odata model.
In the converter settings you need to set RequireDerivedTypesConstraintForODataTypeCastSegments to false.

Expected result

The post/patch/delete paths would be generated for all derived (cast) types.

Actual result

Only the get paths are generated for derived (class) types.

Additional detail

I looked into the code and I have an idea where this is coming from.
The ODataTypeCastPathItemHandler will be used for the path (because of the type cast kind). And there only the Get operation will be set:

https://github.com/microsoft/OpenAPI.NET.OData/blob/92c98108c74121d8eb0eec334762bbcaf6c16007/src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs#L16

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

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

はじめの一歩

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

調査の方向性

src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs から開始し、特に issue で参照されている型キャストパスの処理を確認します。ベース クラス A、派生クラス B を使用し、RequireDerivedTypesConstraintForODataTypeCastSegments を false に設定したケースを再現します。完了条件は、キャスト型の生成されたパスに GET だけでなく POST、PATCH、DELETE も含まれることです。

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

評価

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

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

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