Repository navigation
Conversation
Move completion, hover and validation to the v10 compileSchema API. v10 keeps sibling keywords next to $ref, so a $ref combined with a oneOf of consts now offers those values as completions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
json-schema-library validates "if" against a copy of the validation path so the nodes it evaluates aren't recorded. The path holds every node visited so far and is never trimmed, so each "if" costs time proportional to everything validated before it and validation is quadratic in document size. Schemas that select definitions with if/then took ~30s on a 380KB document and crashed the tab at 2MB. v10 and v11 are both affected. Compile schemas with drafts whose "if" validator uses the shared path and truncates it afterwards, which discards the same entries without the copy and keeps the dynamic scope for $dynamicRef and $recursiveRef. All features now compile through utils/compile-schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: f286279 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ Deploy Preview for codemirror-json-schema ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
json-schema-library v10 validators return errors only, and its unevaluatedProperties re-runs "if" to find the evaluated branch, so the wrapper's results match the library's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
json-schema-library resolves a $ref by replacing the node with its
target and dropping sibling keywords, the draft 4/7 behaviour, even when
the schema declares draft 2020-12. That discards constructs like
{ "$ref": "#/$defs/key", "oneOf": [ { "const": "..." }, ... ] }
where the oneOf carries the real constraint, so no value completions
are offered and the constraint isn't validated.
Normalize schemas on entry into the equivalent, draft-agnostic
{ "allOf": [ { "$ref": ... }, { ...siblings } ] }. Annotation keywords
(title, description, ...) stay at the top level so property metadata is
preserved. This replaces the getRawSchemaForPointer workaround, which
only followed object properties and broke on a root-level $ref and on
array item pointers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drafts 04, 06 and 07 ignore keywords next to $ref, so rewriting them into an allOf changed what those schemas accept. Skip schemas, and nested resources, whose $schema declares one of those drafts, matching how json-schema-library picks a draft. Schemas without $schema keep being normalized, as the library treats them as 2020-12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bundled extensions accept { schema, fetchSchema }. A view plugin
compiles the schema straight away so features keep working, then
RefResolver collects every external $ref, fetches the base URLs in
parallel, follows transitive refs, caches and deduplicates requests,
guards against cycles and registers each schema with addRemoteSchema.
The resolved node is kept in editor state and used by completion,
hover and validation; the linter refreshes when it changes.
The dev page gets a dynamic mode that loads the schema named in the
document's "$schema".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
samlown
force-pushed
the
upstream-pr/fetch-schema-refs
branch
from
October 27, 2026 14:57
331f886 to
f286279
Compare
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.
Builds on #176 and #177. Only the last commit (f286279) is new here. Once those are merged, this diff will shrink to that commit.
What
Schemas often split their definitions across documents with
"$ref": "https://…". Until now those references were left unresolved, so completion, hover and validation stopped at them. This adds an opt-infetchSchemahook:The same options work for
json5SchemaandyamlSchema. Passing a schema directly, as injsonSchema(schema), still works as before, and so does{ schema }without a hook.How
RefResolvercollects every external$reffrom all schema-bearing keywords, fetches the base URLs (fragment removed) in parallel, and follows transitive refs. It caches and deduplicates requests, guards against cycles, and registers each schema withaddRemoteSchema.RefResolverandcollectExternalRefsare exported.RefResolverapplies the same$refsibling normalization as the editor state.$schema.Tests
pnpm test(180 tests),pnpm tscandpnpm buildpass.🤖 Generated with Claude Code