You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`)
0 commit comments