microsoft / microsoft/OpenAPI.NET.OData

Post/Patch/Delete Paths not generated for type casts

Đang mở
#529 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ả

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

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

Bắt đầu với src/Microsoft.OpenApi.OData.Reader/PathItem/ODataTypeCastPathItemHandler.cs, cụ thể là phần xử lý đường dẫn ép kiểu được tham chiếu trong issue. Tái hiện trường hợp với lớp cơ sở A, lớp dẫn xuất B và RequireDerivedTypesConstraintForODataTypeCastSegments được đặt thành false. Hoàn tất khi các đường dẫn được tạo cho kiểu được ép kiểu bao gồm POST, PATCH và DELETE cùng với GET.

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
Lĩnh vực
api
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
Đặc tả rõ ràng
Mức phù hợp với người mới
54/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.