-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick changes to support array item validation #142
base: main
Are you sure you want to change the base?
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. |
awesome work, @tbrockman ! |
@acao sounds great, will do when I find some time! |
sorry @tbrockman just getting to this now! I will have to be careful about reconciling the changes to pointers |
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 updateskeyFrom
andkeyTo
to be optional, to allow root objects and array elements to not have a key range (which makes sense to me), only a value range.