fix: use location.String() instead of location.Path for origin file tracking#1145
Merged
fenollp merged 1 commit intogetkin:masterfrom Apr 8, 2026
Merged
Conversation
…racking location.Path strips the scheme and host for full URLs, leaving only the path component. For example, for a $ref loaded from https://raw.githubusercontent.com/owner/repo/sha/schemas/pet.yaml, location.Path gives /owner/repo/sha/schemas/pet.yaml — missing the host. Using location.String() preserves the full URL so that origin.Key.File in $ref-referenced files contains the complete URL, enabling consumers (e.g. the oasdiff review UI) to build correct clickable links to the exact file and line on GitHub. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
When a spec is loaded from a URL (e.g.
https://raw.githubusercontent.com/owner/repo/sha/schemas/pet.yaml),location.Pathstrips the scheme and host, leaving only/owner/repo/sha/schemas/pet.yaml. This meansorigin.Key.Filein$ref-referenced files contains an incomplete path instead of the full URL.Fix
Use
location.String()instead oflocation.Path. For URL locations this preserves the full URL; for local file pathsString()andPathare equivalent so there is no behaviour change for local loads.Impact
Consumers that use
origin.Key.Fileto generate links (e.g. linking to a specific line in a GitHub file) receive the complete URL, not a truncated path.