microsoft / microsoft/OpenAPI.NET.OData
When EnableDiscriminatorValue is set to true all types end up with a required property of odata.type
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ả
My understanding is odata.type is only required in the case the type cannot be determined such as it being a type derived from the specified type.
When using EnableDiscriminatorValue = true I get correctly odata.type used as a discriminator when a type has a derived type.
I also get however for seemingly all types, odata.type included as a required property.
Assemblies affected
v1.1.0
Steps to reproduce
- Create an odata model with no derived types.
- Generate an Open API specification from the model with EnableDiscriminatorValue = true.
Expected result
I would only expect odata.type to be required in the case a type is a derived type.
Actual result
odata.type is set as required for all types.
If I use Open API connected services in Visual Studio with the specification to generate a client, the client will fail to deserialize responses missing the required property by default.
Additional detail
This can be worked around in most case.
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 bằng cách tái hiện vấn đề với một mô hình OData không có kiểu dẫn xuất và EnableDiscriminatorValue được đặt thành true, sau đó kiểm tra đặc tả OpenAPI được tạo. Truy nguyên cách siêu dữ liệu discriminator trở thành một thuộc tính bắt buộc; công việc được xem là hoàn tất khi odata.type chỉ bắt buộc ở nơi các kiểu dẫn xuất khiến nó cần thiết, mà không làm hỏng việc giải tuần tự hợp lệ của client.
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ó
- 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