Skip to content

feat: expose where each $ref is declared - #228

Merged
fredbi merged 1 commit into
go-openapi:masterfrom
fredbi:feat/refs-by-location
Aug 8, 2026
Merged

feat: expose where each $ref is declared#228
fredbi merged 1 commit into
go-openapi:masterfrom
fredbi:feat/refs-by-location

Conversation

@fredbi

@fredbi fredbi commented Aug 8, 2026

Copy link
Copy Markdown
Member

AllRefsByLocation returns the analyzed references keyed by the location they were found at, as local JSON references into the document:

"#/paths/~1pets/get/responses/200/schema": "#/definitions/Pet"

The analyzer already indexed references that way, but AllRefs and AllReferences both range over the map taking only its values, so callers wanting to report where a reference sits had no way to reach the keys. Unlike AllRefs, the result is not deduplicated: a reference declared in several places appears under each of its locations.

Additive: nothing existing changes behaviour.

Change type

Please select: 🆕 New feature or enhancement|🔧 Bug fix'|📃 Documentation update

Short description

Fixes

Full description

Checklist

  • I have signed all my commits with my name and email (see DCO. This does not require a PGP-signed commit
  • I have rebased and squashed my work, so only one commit remains
  • I have added tests to cover my changes.
  • I have properly enriched go doc comments in code.
  • I have properly documented any breaking change.

AllRefsByLocation returns the analyzed references keyed by the location they
were found at, as local JSON references into the document:

    "#/paths/~1pets/get/responses/200/schema": "#/definitions/Pet"

The analyzer already indexed references that way, but AllRefs and
AllReferences both range over the map taking only its values, so callers
wanting to report where a reference sits had no way to reach the keys. Unlike
AllRefs, the result is not deduplicated: a reference declared in several places
appears under each of its locations.

Additive: nothing existing changes behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi
fredbi force-pushed the feat/refs-by-location branch from cb5e210 to 231c86a Compare August 8, 2026 18:03
@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.02%. Comparing base (f65b576) to head (231c86a).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #228      +/-   ##
==========================================
+ Coverage   91.83%   92.02%   +0.19%     
==========================================
  Files          30       30              
  Lines        3393     3399       +6     
==========================================
+ Hits         3116     3128      +12     
+ Misses        194      189       -5     
+ Partials       83       82       -1     

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

@fredbi
fredbi merged commit d5b5620 into go-openapi:master Aug 8, 2026
25 checks passed
@fredbi
fredbi deleted the feat/refs-by-location branch August 8, 2026 18:10
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