-
Notifications
You must be signed in to change notification settings - Fork 21
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
Feature request: Selection of object properties/keys with values of the correct type. #141
Comments
This request appears to be related to this one: |
Okay, couple of things:
So here is a modification with the correct schema a string default and it's working as expected when adding the https://codesandbox.io/p/sandbox/json-edit-react-demo-forked-wqsmkc?file=%2Fsrc%2FApp.js%3A47%2C26 Hope that helps :) |
Thank you for your kind reply even for a silly mistake.
My intuition is that when I provide a JSON Schema, I have to provide a |
No problem. Sorry, I posted my local link rather than the public demo: https://carlosnz.github.io/json-edit-react/?data=customNodes
Yes, it would be good to have default values generated automatically, but adding this into the core package is beyond the scope of what this tool should do for now. We can do JSON schema validation, but the actual validation is done by an external tool, so I imagine something similar could be done for this. It would involve fairly complicated JSON schema parsing, so I wouldn't want to include it in the main package, but if someone wanted to create one, it could be a good supplement. You'd need to write a function to input a JSON schema and output a "DefaultValueFilterFunction" -- definitely a non-trivial task. I might have a crack at it one day, but it'd be great if someone wanted to contribute one. |
Describe the Difficulty
When entering a key to add, the default value is maybe null, so it is rejected by validate.
I'm imitating the onUpdate validation in the demo source code. But I can't add a value because it's rejected by that validation.
Describe the Request
When entering a key to add, it would be nice if the appropriate value was already entered.
Online demo
I'm imitating the jsonSchemaValidation in the sample demo that was released to the public. Since the name doesn't exist, I'll add it, but I'll get a validation error.
https://codesandbox.io/p/sandbox/json-edit-react-demo-forked-2d6xlx?file=%2Fsrc%2FApp.js%3A9%2C13&workspaceId=ws_CTwx66TnRUb2vkBSHCXygH
The text was updated successfully, but these errors were encountered: