Quick changes to support array item validation#142
Open
tbrockman wants to merge 5 commits intojsonnext:mainfrom
Open
Quick changes to support array item validation#142tbrockman wants to merge 5 commits intojsonnext:mainfrom
tbrockman wants to merge 5 commits intojsonnext:mainfrom
Conversation
…keyTo and keyFrom (arrays items), updates tests to reflect the changes, and modifies some error path code to better match VSCode JSON schema linting behavior.
🦋 Changeset detectedLatest commit: 69e36c6 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 site configuration. |
Collaborator
|
awesome work, @tbrockman ! |
Author
|
@acao sounds great, will do when I find some time! |
Collaborator
|
sorry @tbrockman just getting to this now! I will have to be careful about reconciling the changes to pointers |
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.
Not sure whether this contribution will be appreciated (and I totally won't be offended if it isn't), but I wanted syntax highlighting on individual (non-object) array items to work (plus to change some linting behavior to mirror VSCode a bit more closer, for ex. missing required properties highlighting the key) and I'd already done a bit of poking around the code to patch away the use of
shikijs(my specific use-case makes it a bit less straight-forward to use things which require WASM), and had plans to make changes to autocomplete... so I just figured what the heck, may as well make a fork.Rather than hoard my changes I thought I'd share them in case they're at all useful to the project. Admittedly, I haven't thoroughly tested them (beyond passing tests), so I'm open to making some edits if it turns out to have been an incorrect approach, but so far it seems to work for my needs.
This PR extends the existing
getJsonPointers()code to add support for registering pointers to non-object array items, returning most specific error paths (when possible), and updates existing tests to reflect the changes. It also updateskeyFromandkeyToto be optional, to allow root objects and array elements to not have a key range (which makes sense to me), only a value range.