microsoft / microsoft/OpenAPI.NET.OData
Enum return value schema is wrong
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ả
If a function returns Enum resulting schema is not wrapped but instead represented as enum itself.
Assemblies affected
Microsoft.OpenApi.OData 1.7.4
Steps to reproduce
I have a function that returns enum. It goes like this:
<Function Name="GetRemoteAccessStatus" IsBound="true">
<ReturnType Type="RemoteAccessStatus" Nullable="false"/>
</Function>
<EnumType Name="RemoteAccessStatus">
<Member Name="None" Value="0"/>
<Member Name="Requested" Value="1"/>
<Member Name="Active" Value="2"/>
</EnumType>
Expected result
In the resulting schema I want to see something like this:
schema:
type: object
properties:
value:
anyOf:
- $ref: '#/components/schemas/RemoteAccessStatus'
Actual result
Actually I get (skipped value):
schema:
$ref: '#/components/schemas/Pbx.RemoteAccessStatus'
Additional information
I thinks the issue is in OpenApiResponseGenerator.cs where for collection and primitive types it wraps the responses but not for Enum
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong OpenApiResponseGenerator.cs và tái tạo response của function bằng OData CSDL được cung cấp. So sánh cách các kiểu trả về collection và primitive được bao bọc bằng enum path, sau đó xác minh rằng schema được tạo sử dụng một object với thuộc tính value tham chiếu đến RemoteAccessStatus.
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
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- 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
- 55/100