Support xs-ms-enum values without the "value" label
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra XmsEnumExtension và XmsEnumValue, sau đó tái hiện lỗi giải tuần tự của Newtonsoft.Json với JSON x-ms-enum được cung cấp trong đường dẫn so sánh của OpenApi-Diff. Công việc được xem là hoàn tất khi các mục enum được biểu diễn dưới dạng giá trị nguyên thủy, bao gồm 3, 4 và 5, có thể được giải tuần tự và so sánh mà không phát sinh JsonSerializationException.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Some contract generators define the values of x-ms-enum as a list of actual values without labels.
The current version OpenApi-Diff doesn't support this format and throws a Newtonsoft.Json.JsonSerializationException in this case.
Example of x-ms-enum with and without the "value" label
"enum": [
"Mammals",
"Fish",
"Birds",
"Reptiles",
"Amphibians",
"Invertebrates"
],
"type": "string",
"x-ms-enum": {
"name": "PetType",
"modelAsString": false,
"values": [
{
"value": 0,
"description": "humans and all other animals that are warm-blooded vertebrates",
"name": "Mammals"
},
{
"value": 1,
"description": "aquatic, craniate, gill-bearing animals that lack limbs with digits"
},
{
"value": 2,
"name": "Birds"
},
3,
4,
5
],
"x-nullable": false
}
The issue with this XmsEnumExtension is that we cannot cast an object of primitive type (e.g. long, string) to a XmsEnumValue , thus all contracts that contains x-ms-enum with a list of values of primitive type causes a deserialization issue in the OpenApiDiff comparison.
The exception is the following
Newtonsoft.Json.JsonSerializationException : Error converting value 3 to type 'AutoRest.Swagger.Model.XmsEnumValue'. Path 'definitions.PetType.x-ms-enum.values[0]', line 235, position 11.
----> System.ArgumentException : Could not cast or convert from System.Int64 to AutoRest.Swagger.Model.XmsEnumValue.
- Ngôn ngữ chính
- C#
- Star
- 290
- Fork
- 50
- Merge trung bình
- 2 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 10
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.
Issue khác của Azure/openapi-diff
-
Azure/openapi-diff#482 · 1 người được giao ·
-
Azure/openapi-diff#479 · 2 bình luận · 1 người được giao ·
-
Remove dependency `autorest` Đang mở
Azure/openapi-diff#456 · 1 người được giao ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Azure/openapi-diff#445 ·
-
Azure/openapi-diff#371 · 7 bình luận · 1 người được giao ·
Tất cả issue của Azure/openapi-diff
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
nightscout/nocturne#1425 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cake-build/cake#5024 ·
-
Gå gjennom ESLint-suppressions Đang mởFrontend status/draft TechnicalDebt
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 75/100
Altinn/altinn-auth#4143 ·