Fix false positive diff when exploded param name matches property name#780
Merged
reuvenharrison merged 1 commit intomainfrom Jan 12, 2026
Merged
Conversation
Fixes #767 This fixes 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. The issue occurred in the exploded parameter semantic equivalence matching logic introduced in PR #744. When a parameter like "query" had an exploded object schema containing a property also named "query", the matching algorithm incorrectly considered the parameter equivalent to itself, causing false diff reports. The fix adds a check in matchExplodedWithSimple() to skip parameters that are themselves exploded object parameters when looking for simple parameters to match. This ensures we only match truly simple parameters with exploded parameters, not exploded parameters with themselves. Changes: - Added check in matchExplodedWithSimple to skip exploded parameters in the "simple" parameter list - Added regression test TestIssue767_ExplodedParamWithSameNameProperty - Added test fixture data/explode-params/issue-767.yml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #780 +/- ##
=======================================
Coverage 88.71% 88.71%
=======================================
Files 246 246
Lines 12140 12142 +2
=======================================
+ Hits 10770 10772 +2
Misses 931 931
Partials 439 439
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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