-
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
Get sub schema using parsed data for additional context #133
Conversation
🦋 Changeset detectedLatest commit: c04ef4f 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. |
oh I love this! |
@imolorhe my only question is, why do we make this disabled by default? |
@acao didn't want to change more behavior than necessary. Enabling it by default causes a test case ( |
@imolorhe sounds good to me! normally for > 0.x I would tag a new feature as a minor release, but with 0.x I think we just patch |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## [email protected] ### Patch Changes - [#133](#133) [`4fd7cc6`](4fd7cc6) Thanks [@imolorhe](https://github.com/imolorhe)! - Get sub schema using parsed data for additional context - [#137](#137) [`29e2da5`](29e2da5) Thanks [@xdavidwu](https://github.com/xdavidwu)! - Fix description markdown rendering in completion - [#144](#144) [`ef7f336`](ef7f336) Thanks [@imolorhe](https://github.com/imolorhe)! - updated to use fine grained shiki bundle - [#139](#139) [`bfbe613`](bfbe613) Thanks [@NickTomlin](https://github.com/NickTomlin)! - Move non essential packages to devDependencies - [#140](#140) [`bceace2`](bceace2) Thanks [@NickTomlin](https://github.com/NickTomlin)! - Add CONTRIBUTING.md file Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
As mentioned in #132, the "calculated" sub schema for a path in the JSON document can change based on the values of other fields in the document.
json-schema-library
already has the feature to get schema with the data when the schema is dynamic.To retrieve the data, I added
best-effort-json-parser
so we can get some data even if the JSON document isn't in a valid JSON state (which is going to be the case while writing the document). Given a document in the following state:it is able to retrieve the data as:
...which is sufficient context (at least for all the existing test cases)
Other changes in this PR include:
DocumentParser
type and moved parsers into a separate directoryloglevel
for better log tracing (logs now point to the file the logs come from as opposed todebug.ts
)