Skip to content

fix: strip __origin__ from slices in example values#4

Open
tvisser-hartwig wants to merge 1 commit intooasdiff:masterfrom
tvisser-hartwig:fix/strip-origin-from-slices
Open

fix: strip __origin__ from slices in example values#4
tvisser-hartwig wants to merge 1 commit intooasdiff:masterfrom
tvisser-hartwig:fix/strip-origin-from-slices

Conversation

@tvisser-hartwig
Copy link

@tvisser-hartwig tvisser-hartwig commented Mar 18, 2026

Summary

  • stripOriginFromAny only recursed into map[string]any but not []any slices
  • This caused __origin__ keys inside array elements to survive stripping
  • Affects example values containing lists of objects (e.g. a multiple request/response examples with arrays)
  • This in turn causes oasdiff diff to report false positive diffs when comparing identical specs loaded from different file paths (follow-up to openapi3: strip __origin__ from Encodings and ServerVariables maps getkin/kin-openapi#1132)

Fix

Extend the switch in stripOriginFromAny to also handle []any, recursing into each element.

Test plan

  • TestStripOriginFromAny_Slice: unit test that verifies __origin__ is stripped from objects inside slices
  • TestOrigin_ExampleWithArrayValue: integration test that loads a spec with array-valued examples and verifies __origin__ is stripped
  • All existing tests pass: go test ./...

🤖 Generated with Claude Code

stripOriginFromAny only recursed into map[string]any but not []any,
so __origin__ keys inside array elements (e.g. example values with
lists of objects) survived stripping and caused false positive diffs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tvisser-hartwig tvisser-hartwig force-pushed the fix/strip-origin-from-slices branch from 9998528 to 697d4b9 Compare March 18, 2026 13:44
@tvisser-hartwig tvisser-hartwig changed the title fix: strip __origin__ from slices in example values fix: strip __origin__ from slices in example values Mar 18, 2026
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.

1 participant