-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get sub schema using parsed data for additional context (#133)
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](https://github.com/sagold/json-schema-library?tab=readme-ov-file#getschema) 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: ```json { "type": "Test_2", "props": { te } } ``` it is able to retrieve the data as: ```json { "type": "Test_1", "props": { "te": null } } ``` ...which is sufficient context (at least for all the existing test cases) Other changes in this PR include: - deleted unused (old) json-completion.ts file - created the `DocumentParser` type and moved parsers into a separate directory - added `loglevel` for better log tracing (logs now point to the file the logs come from as opposed to `debug.ts`)
- Loading branch information
Showing
21 changed files
with
230 additions
and
1,019 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"codemirror-json-schema": patch | ||
--- | ||
|
||
Get sub schema using parsed data for additional context |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.