Repository navigation
Conversation
…d `$id` When the root has no `$id`, repeat refs under an external file's `$id` were qualified with the root's local file path, so the bundle only resolved on the machine that made it. Rewrite those refs, and fragment refs under the same `$id`, as pointers from the document root and remove that `$id`. Groups that use a URI or anchor ref, or whose `$id` a URI ref may target, are left as is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Instead of rewriting refs and removing the nested $id after bundling, record where each nested $id resource sits and, when a repeat ref's target is inside that resource, write it as a pointer from the resource. That needs no URI, so the bundle no longer carries the root's local file path and keeps its $ids. Targets outside the resource are still qualified as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
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.
closes #438
Summary
If an external file has a
$idand refers to the same schema twice,bundle()writes the second ref with the root's local file path in front, so the bundle breaks anywhere else. When the target is inside the same$idresource as the ref, this writes it as a pointer from that resource instead (for example#/properties/test1), which needs no URI and keeps the$id. Refs whose target is outside the resource are qualified as before.Not covered
A ref inside a nested
$idwhose target was inlined outside that resource, with no root$id, still gets the root's file path. Nothing portable can point there without removing the nested$id, so that's left for a separate, opt-in change if it's wanted.Verification
pnpm build,pnpm typecheck,pnpm lintbundle-id-refs-no-root-idspec: repeat refs under one$idand under a$idnested in another, a URI ref to the resource, and a target outside the resource. The portable cases also dereference without the source files.🤖 Generated with Claude Code