fix(json-schema-ref-parser): use synthetic root path in mergeMany to avoid $ref collision#4147
Merged
Merged
Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2953324 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@hey-api/codegen-cli
@hey-api/codegen-core
@hey-api/json-schema-ref-parser
@hey-api/nuxt
@hey-api/openapi-python
@hey-api/openapi-ts
@hey-api/shared
@hey-api/spec-types
@hey-api/types
@hey-api/vite-plugin
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4147 +/- ##
==========================================
+ Coverage 37.00% 37.12% +0.12%
==========================================
Files 679 679
Lines 23836 23835 -1
Branches 7163 7147 -16
==========================================
+ Hits 8820 8849 +29
+ Misses 12079 12056 -23
+ Partials 2937 2930 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…avoid $ref collision Storing the merged schema under the first input's path overwrote that file's $refs entry. When another input referenced the same file, pointer resolution ran against the prefixed merged schema and crashed. Using a synthetic root path (/__merged__) prevents the collision so external refs are resolved from the original source. Fixes #4146
83902bb to
184666e
Compare
mrlubos
approved these changes
Jun 24, 2026
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.
Fixes #4146 #4112.
$RefParser.mergeMany()previously stored the merged schema under the first input's path. That overwrote the$refsentry for that file, so when another input contained an external$refback to the same file, pointer resolution ran against the merged (prefixed) schema and crashed.This change stores the merged root under a synthetic path (
/__merged__) so the original input files remain in$refsand external references are resolved from their true source.mergeMany()root path inpackages/json-schema-ref-parser/src/index.ts$refcrash inpackages/json-schema-ref-parser/src/__tests__/bundle.test.tsopenrouter/moonshotai/kimi-k2.7-code(free via Pullfrog for OSS) | 𝕏