Unify Handling of allOf/anyOf and oneOf in Diff logic
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start with SchemaDiff#resolveComposedSchema and SchemaDiff#addSchema to understand how allOf/anyOf are flattened, then read ComposedSchemaDiffResult#diff and ChangedOneOfSchema for the existing oneOf comparison. Define how structural additions, removals, and modifications in allOf/anyOf should appear alongside flattened property changes; done means the diff reports composition changes consistently without losing relevant details.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 191
- Avg merge
- 4d 23h
- Merged PRs (30d)
- 1
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenAPITools/openapi-diff
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-diff#506 ·
Maintainers usually reply within 5 days
-
HtmlRender: Notes of Parameters shows always the new descriptionPossibly taken @Inf1mum claimed this 6 days ago. Opengood first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
OpenAPITools/openapi-diff#364 ·
Maintainers usually reply within 5 days
-
Render capabilities
Difficulty 5/5 Over a week Newbie friendliness 20/100
OpenAPITools/openapi-diff#959 ·
Maintainers usually reply within 5 days
-
Render capabilities
Difficulty 5/5 Over a week Newbie friendliness 18/100
OpenAPITools/openapi-diff#958 ·
Maintainers usually reply within 5 days
-
Render capabilities
Difficulty 3/5 1-2 days Newbie friendliness 55/100
OpenAPITools/openapi-diff#957 ·
Maintainers usually reply within 5 days
All issues in OpenAPITools/openapi-diff
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
eclipse-tradista/tradista#371 ·
Maintainers usually reply within 1 day
-
critical
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mars-sim/mars-sim#2199 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
projeto-ong-amar/projeto-ong-amar-backend#26 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
primefaces/primefaces#15568 ·
Maintainers usually reply within 1 day
-
崩溃日志只按 CRLF 分行Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PCL-Community/PCL-CE#3872 ·
Maintainers usually reply within 1 day