fix(schema): resolve $ref pointers below a top-level definition in fromJsonSchemaDocument - #8180
Open
Ishkirat-Singh wants to merge 1 commit into
Conversation
Ishkirat-Singh
requested a deployment
to
fork
September 10, 2026 22:24 — with
GitHub Actions
Waiting
🦋 Changeset detectedLatest commit: b93b1e2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 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 |
fromJsonSchemaDocument only accepted #/$defs/<name> references. A pointer that descends below a definition, such as #/definitions/update/properties/schedule, is now walked from the named definition and translated in place at the use site. Dangling and self-referencing pointers are reported with the full pointer. Closes Effect-TS#7418
Ishkirat-Singh
force-pushed
the
fix/json-schema-pointer-refs-below-definitions
branch
from
September 10, 2026 22:46
361bc84 to
b93b1e2
Compare
Ishkirat-Singh
requested a deployment
to
fork
September 10, 2026 22:46 — with
GitHub Actions
Waiting
Ishkirat-Singh
requested a deployment
to
fork
September 10, 2026 22:46 — with
GitHub Actions
Waiting
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
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 #7418.
Problem
SchemaRepresentation.fromJsonSchemaDocumentonly accepts$refs of the form#/$defs/<name>(or#/definitions/<name>after normalisation). A pointer that descends below a definition, such as#/definitions/update/properties/schedule, throwsUnsupported referencesince #7415, so a document that uses that form anywhere cannot be imported at all. Hand-written schemas use it routinely; SchemaStore'sdependabot-2.0.jsonhas 14 of them.Change
JsonSchema.getReferencePath(internal): returns the unescaped tokens of a local reference that points below a top-level definition,undefinedotherwise.getReferenceKeyis unchanged, so plain definition references keep going through the existingReferencepath.fromJsonSchemaDocument: whengetReferenceKeyrejects a$ref, the newtranslatePointerReferencewalks the tokens from the named definition (object keys and array indices, for exampleanyOf/1) and translates the pointed subschema in place at the use site. Sibling keywords on the referencing schema intersect with it as before. A pointer that leads nowhere reportsUnresolvable $refwith the full pointer; a pointer that leads back to itself reportsRecursive $ref ... cannot be inlinedinstead of recursing forever. Messages follow the style introduced in feat(SchemaRepresentation): improve JSON Schema imports #8169.Tests
packages/effect/test/schema/representation/fromJsonSchemaDocument.test.ts: the test that asserted rejection is replaced by five cases: a pointer below a definition, a pointer through an array index, a pointer next to other keywords, a dangling pointer, and a self-referencing pointer. Ran the file locally together withtsc -b,dprint checkandoxlint.Changeset included (
effect, patch).