Skip to content

fix: normalize equivalent object unions - #55

Open
sidsri14 wants to merge 1 commit into
getsentry:mainfrom
sidsri14:sidsri14/normalize-object-anyof
Open

fix: normalize equivalent object unions#55
sidsri14 wants to merge 1 commit into
getsentry:mainfrom
sidsri14:sidsri14/normalize-object-anyof

Conversation

@sidsri14

Copy link
Copy Markdown

Summary

  • normalize pure top-level anyOf object branches when they differ only in one property's type
  • compare the normalized object union against an equivalent multi-type property in either direction
  • keep correlated multi-property unions intact to avoid widening their accepted values

Closes #22

Verification

  • cargo fmt --all -- --check
  • cargo test --workspace --all-features
  • cargo clippy --all-features --workspace --tests --examples -- -D clippy::all
  • git diff --check

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 65dc1fc. Configure here.

Comment thread src/diff_walker.rs
) -> Result<(), Error> {
self.resolve_references(lhs, rhs)?;
Self::collapse_object_any_of(lhs);
Self::collapse_object_any_of(rhs);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asymmetric anyOf collapse breaks diffs

Medium Severity

collapse_object_any_of runs independently on each side. When only one pure object anyOf collapses and the other keeps a non-collapsible anyOf, diff_any_of is skipped. Property comparison then treats the remaining anyOf as having no top-level properties, so it emits spurious PropertyRemove changes and misses real branch-level differences.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 65dc1fc. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

objects inside anyOf v.s. multiple types inside object

1 participant