OpenAPITools / OpenAPITools/openapi-diff
[Bug] Backward compatibility check fails on reordered discriminator mappings
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 1.1k
- Fork
- 190
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Ran into a compatibility issue, which I believe is a false positive. I have one polymorphic schema, that maps to two different property names. The backwards compatibility check fails if the mappings are re-ordered.
This should not be failing, because neither discriminator names nor the mapping changed.
For example, the following 2 should be considered compatible, but are not. Assume the actual schemas are identical. Schema A is mapped to a-type and z-type which are present in both mappings, but are ordered differently.
schema:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
discriminator:
propertyName: realtype
mapping:
z-type: '#/components/schemas/A'
a-type: '#/components/schemas/A'
b-type: '#/components/schemas/B'
and
schema:
oneOf:
- $ref: '#/components/schemas/A'
- $ref: '#/components/schemas/B'
discriminator:
propertyName: realtype
mapping:
a-type: '#/components/schemas/A'
z-type: '#/components/schemas/A'
b-type: '#/components/schemas/B'
I was able to reproduce this in this repo by adding a test to OneOfDiffTest with the above as an example (based on oneOf_discriminator-missing_1.yaml).
@Test
public void testOneOfDiscrimitatorDifferentOrder() {
assertOpenApiAreEquals(OPENAPI_DOC11, OPENAPI_DOC12);
}
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 với OneOfDiffTest hiện có và ví dụ oneOf_discriminator-missing_1.yaml được đề cập trong issue. Thêm hoặc chạy trường hợp mapping được sắp xếp lại, sau đó lần theo điểm vào của phép so sánh mà trường hợp đó thực thi. Hoàn thành khi hai schema được hiển thị được xử lý là tương thích trong trường hợp chỉ khác thứ tự mapping của discriminator.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- 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
- 55/100