microsoft / microsoft/OpenAPI.NET.OData

Action bound to abstract entity type is not present in OpenAPI output when using hidi to convert from CSDL

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

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

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

説明

Describe the bug
When generating the OpenAPI description for Microsoft Graph Beta the offboard and cancelOffboard routes are not generated for the protectionUnit entity

Reproduction Steps

In a PowerShell terminal with dotnet 9

dotnet tool install --global Microsoft.OpenApi.Hidi
git clone https://github.com/microsoftgraph/msgraph-metadata.git
hidi transform --csdl .\msgraph-metadata\clean_beta_metadata\cleanMetadata.xml --output .\beta-enhanced-restore.yaml --co  --version "3.0" --metadata-version "beta" --log-level Trace --format yaml --settings-path .\msgraph-metadata\conversion-settings\openapi.json

Alternatively if you clone the internal AD-AggregatorService-Workloads you can use a smaller source csdl file:

hidi transform --csdl .\AD-AggregatorService-Workloads\Workloads\Microsoft.EnhancedRestore\override\schema-Prod-beta.csdl --output .\beta-enhanced-restore-3.1.yaml --co  --version "3.1" --metadata-version "beta" --log-level Trace --format yaml

When opening the newly created beta-enhanced-restore.yaml you will not find a path that includes /cancelOffboard

When examining the smaller CSDL fragment for the Microsoft.EnhancedRestore I can see that the impacted Actions are all bound to an abstract type.

      <EntityType Name="protectionUnitBase" BaseType="microsoft.graph.entity" Abstract="true" >
        <Property Name="policyId" Type="Edm.String" />
        <Property Name="status" Type="self.protectionUnitStatus" />
        <Property Name="createdDateTime" Type="Edm.DateTimeOffset" />
        <Property Name="createdBy" Type="microsoft.graph.identitySet" />
        <Property Name="lastModifiedDateTime" Type="Edm.DateTimeOffset" />
        <Property Name="lastModifiedBy" Type="microsoft.graph.identitySet" />
        <Property Name="protectionSources" Type="self.protectionSource" Nullable="false" />
        <Property Name="error" Type="microsoft.graph.publicError" />
        <Property Name="offboardRequestedDateTime" Type="Edm.DateTimeOffset" />
      </EntityType>
      <EntityType Name="protectionRuleBase" BaseType="microsoft.graph.entity" Abstract="true" >
        <Property Name="status" Type="self.protectionRuleStatus" />
        <Property Name="createdDateTime" Type="Edm.DateTimeOffset" />
        <Property Name="createdBy" Type="microsoft.graph.identitySet" />
        <Property Name="lastModifiedDateTime" Type="Edm.DateTimeOffset" />
        <Property Name="lastModifiedBy" Type="microsoft.graph.identitySet" />
        <Property Name="error" Type="microsoft.graph.publicError" />
        <Property Name="isAutoApplyEnabled" Type="Edm.Boolean" />
      </EntityType>
      <Action Name="run" IsBound="true">
        <Parameter Name="bindingParameter" Type="self.protectionRuleBase"/>
        <ReturnType Type="self.protectionRuleBase"/>
      </Action>
      <Action Name="deleteAndUnprotect" IsBound="true" >
        <Parameter Name="bindingParameter" Type="self.protectionRuleBase"/>
        <ReturnType Type="self.protectionRuleBase"/>
      </Action>
    <Action Name="offboard" IsBound="true">
      <Parameter Name="bindingParameter" Type="self.protectionUnitBase"/>
      <ReturnType Type="self.protectionUnitBase"/>
    </Action>
    <Action Name="cancelOffboard" IsBound="true" >
      <Parameter Name="bindingParameter" Type="self.protectionUnitBase"/>
      <ReturnType Type="self.protectionUnitBase"/>
    </Action>

Expected behavior
the /offboard and /cancelOffboard request URIs are described in the OpenAPI output.

Additional context
This is an issue preventing the generated SDKs for Microsoft Graph from including these requests.

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

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

はじめの一歩

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

調査の方向性

参照されている CSDL 入力と conversion-settings/openapi.json を使用して、Hidi コマンドで問題を再現します。生成された YAML を抽象的な protectionUnitBase アクションと比較し、/offboard と /cancelOffboard が存在しないことを確認します。両方のリクエスト URI が OpenAPI 出力に表示されれば完了です。

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

評価

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

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

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