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 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
240
派生
70
平均合并
7 小时 59 分钟
30 天内合并 PR
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 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 摘要。