microsoft / microsoft/OpenAPI.NET.OData

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

Đang mở
#720 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
C#
Star
240
Fork
70
Merge trung bình
7 giờ 59 phút
Pull request đã merge (30 ngày)
13

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện sự cố bằng lệnh Hidi với đầu vào CSDL được tham chiếu và conversion-settings/openapi.json. So sánh YAML được tạo với các action protectionUnitBase trừu tượng và xác minh xem /offboard và /cancelOffboard có bị thiếu hay không. Được coi là hoàn tất khi cả hai URI yêu cầu đều xuất hiện trong đầu ra OpenAPI.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, openapi
Lĩnh vực
api, backend-api-design
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.