Skip to content

Conversation

@reuvenharrison
Copy link
Collaborator

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 diff on identical files, the tool incorrectly reported modifications in cases where:

  • A parameter has an exploded object schema (e.g., explode: true)
  • The parameter name matches a property name within that parameter's schema
  • Example: A parameter named query containing a schema with a property also named query

This 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

  • diff/parameters_diff_by_location.go: Added check to filter out exploded object parameters from the "simple" parameter list before matching
  • diff/parameters_diff_by_location_test.go: Added regression test TestIssue767_ExplodedParamWithSameNameProperty
  • data/explode-params/issue-767.yml: Added test fixture demonstrating the bug scenario

Testing

  • ✅ New regression test passes
  • ✅ All existing tests pass
  • ✅ Verified fix resolves the issue: oasdiff diff test.yml test.yml now correctly returns no diff

Test plan

  • Run full test suite: go test ./...
  • Verify regression test: go test ./diff/... -run TestIssue767
  • Manual verification with issue-767.yml fixture

🤖 Generated with Claude Code

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-commenter
Copy link

codecov-commenter commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.71%. Comparing base (754626c) to head (3aeb15b).

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           
Flag Coverage Δ
unittests 88.71% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@reuvenharrison reuvenharrison merged commit 15217b3 into main Jan 12, 2026
14 checks passed
@reuvenharrison reuvenharrison deleted the fix/issue-767-exploded-param-self-match branch January 12, 2026 19:03
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.

Diffing two identical files yields non-empty diff

3 participants