OpenAPITools / OpenAPITools/openapi-diff
Unify Handling of allOf/anyOf and oneOf in Diff logic
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ả
Current Behavior:
The diffing mechanism currently handles allOf/anyOf and oneOf differently within composed schemas:
-
allOf/anyOf: These schemas are recursively resolved and their properties are merged into the parent schema before the main diffing occurs. This happens inSchemaDiff#resolveComposedSchema, where properties fromallOf/anyOfsubschemas are added to the parent usingSchemaDiff#addSchema. The originalallOf/anyOfstructure is effectively flattened. -
oneOf: These schemas are not merged beforehand. Instead, theComposedSchemaDiffResult#diffmethod performs a structural comparison of theoneOflists between the old and new schemas. It identifies added, removed, or changedoneOfoptions, storing the results in aChangedOneOfSchemaobject which is then attached to theChangedSchema.
Suggested Behavior:
This difference in processing leads to an inconsistency. While the merging for allOf/anyOf simplifies property comparison later, it loses the structural information about changes within the allOf/anyOf lists. Conversely, oneOf retains this structural information because it's crucial for understanding changes in available options.
Consider unifying the approach. Perhaps allOf/anyOf could also be compared structurally, similar to oneOf, to provide a more consistent and potentially more informative diff result regarding the composition itself, rather than just the flattened outcome. This would allow tracking additions, removals, or modifications within allOf/anyOf lists directly.
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 SchemaDiff#resolveComposedSchema và SchemaDiff#addSchema để hiểu cách allOf/anyOf được làm phẳng, sau đó đọc ComposedSchemaDiffResult#diff và ChangedOneOfSchema để xem cách so sánh oneOf hiện có. Xác định cách các phần tử được thêm, xóa và sửa đổi về mặt cấu trúc trong allOf/anyOf cần xuất hiện cùng với các thay đổi thuộc tính đã được làm phẳng; hoàn tất khi diff báo cáo nhất quán các thay đổi về composition mà không làm mất các chi tiết liên quan.
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
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- 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
- 35/100