fix: highlight invalid property values and array items - #173
Open
falko-apheris wants to merge 1 commit into
Open
falko-apheris wants to merge 1 commit into
falko-apheris wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 5cb6c1f 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. |
This was referenced Sep 21, 2026
Author
|
Hello there, any updates on this? |
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.
Summary
Fixes #158 and fixes #165.
Schema validation detects these errors, but their diagnostic ranges can point to the start of the document, a colon, or a neighboring token instead of the invalid value.
For example, an integer-array schema applied to
{"values": [0, "invalid", 2]}now highlights"invalid", rather than producing a zero-length diagnostic at the document start.Related work
This overlaps with #142 by @tbrockman and follows the same value-only-pointer approach for array items. This PR is a focused fix against current
main, adding grammar-independent property-value lookup and regression coverage while retaining the existing missing-required-property highlighting behavior. It does not change dependencies, lockfiles, validation rules, or error messages.Verification
pnpm run test --run --silent --no-file-parallelism: 177 tests passed.@lezer/json@1.0.3temporarily substituted for locked1.0.1: 177 tests passed. Restored the original dependency afterward; no dependency changes are included.pnpm run tscandpnpm run buildpassed.42and array itemfalse; no JavaScript page errors.Existing tooling notes: I used pnpm 9.15.9 for the frozen install because
packageManagerspecifies pnpm 8.6.6 but the checked-in lockfile is version 9. Parallel test execution intermittently produced incomplete syntax-tree/range failures on this machine; I reproduced that on untouchedmainas well. The serial suite passes. Those unrelated tooling issues are not changed here.Browser proof
The screenshot uses the demo's existing
package.jsonschema and generic inputs, with no response overrides or changes to the demo: