Fix false positive diff when exploded param name matches property name #780
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #767 - Resolves a bug where comparing identical OpenAPI specs incorrectly reported differences when an exploded object parameter's name matched a property name within its own schema.
Problem
When running
oasdiff diffon identical files, the tool incorrectly reported modifications in cases where:explode: true)querycontaining a schema with a property also namedqueryThis caused false positive diffs showing type changes and deleted properties that didn't actually exist.
Root Cause
The exploded parameter semantic equivalence matching logic (introduced in PR #744) was checking if a parameter's name matched properties in exploded object schemas. However, it didn't exclude the case where the parameter being checked was itself an exploded object parameter, leading it to match against properties in its own schema.
Solution
Added a check in
matchExplodedWithSimple()to skip parameters that are themselves exploded object parameters when searching for simple parameters to match with exploded parameters. This ensures we only match truly simple parameters with exploded parameters, not exploded parameters with themselves.Changes
TestIssue767_ExplodedParamWithSameNamePropertyTesting
oasdiff diff test.yml test.ymlnow correctly returns no diffTest plan
go test ./...go test ./diff/... -run TestIssue767🤖 Generated with Claude Code