-
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
The library ignores conditional schema structure #132
Comments
acao
pushed a commit
that referenced
this issue
Jun 23, 2024
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`)
github-project-automation
bot
moved this from Backlog
to Done
in codemirror-json-schema roadmap
Jun 23, 2024
github-project-automation
bot
moved this from Done
to Todo
in codemirror-json-schema roadmap
Jul 4, 2024
@imolorhe does that PR work with conditionals!? or did we close thia by accident |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Thanks for this library guys! I'm implementing a JSON editor and I want the user to get autocomplete in one field depending on the value of another field. For this purpose I've got the schema similar to below:
So I expect that when I'm typing in "Test_1" in
type
field, I get onlytest1Props
as a suggestion inprops
field but instead I get both:Here is my React component:
I'm using: node v18.7.0, "codemirror-json-schema": "^0.7.8", "@codemirror/lang-json": "^6.0.1", "@uiw/react-codemirror": "^4.22.1".
The text was updated successfully, but these errors were encountered: