You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 in SchemaDiff#resolveComposedSchema, where properties from allOf/anyOf subschemas are added to the parent using SchemaDiff#addSchema. The original allOf/anyOf structure is effectively flattened.
oneOf: These schemas are not merged beforehand. Instead, the ComposedSchemaDiffResult#diff method performs a structural comparison of the oneOf lists between the old and new schemas. It identifies added, removed, or changed oneOf options, storing the results in a ChangedOneOfSchema object which is then attached to the ChangedSchema.
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.
The text was updated successfully, but these errors were encountered:
Current Behavior:
The diffing mechanism currently handles
allOf
/anyOf
andoneOf
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
/anyOf
subschemas are added to the parent usingSchemaDiff#addSchema
. The originalallOf
/anyOf
structure is effectively flattened.oneOf
: These schemas are not merged beforehand. Instead, theComposedSchemaDiffResult#diff
method performs a structural comparison of theoneOf
lists between the old and new schemas. It identifies added, removed, or changedoneOf
options, storing the results in aChangedOneOfSchema
object 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 theallOf
/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 tooneOf
, 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 withinallOf
/anyOf
lists directly.The text was updated successfully, but these errors were encountered: