-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Enable displaying a node schema type instead of its value #445
base: develop
Are you sure you want to change the base?
Conversation
… tree should indicate. If set to 'value' (default) it displays the node value, as it used to do. If set to 'schema' and a schema has been defined in the options, it displays the schema type of the node. If set to 'schema-if-null', it only displays the schema type if the value of the node is null.
Thanks Olivier, I will look into your PR within a few days. |
It's an interesting idea to give the user information about the expected type of value (based on the JSON schema). Thanks for adding an example too which demonstrates the feature. I was just thinking a bit more about you solution. It may not be needed to implement this as an option I'm not sure about the usecase for "valueDisplayMode: 'Schema'", where you can't edit the values, can you elaborate a bit more about the use cases you have in mind? |
I have another feature in mind. I know it's not part of this pull request but it's kinda related so I thought I would get your thoughts on that. |
I can't come up with use cases for the switcher, and if you don't have concrete use cases either I propose not to implement it until use cases for this pops up. I think though that in practice you don't want to switch between value or schema, but you want to enrich the value with information from the schema. A placeholder text is the simplest one. We could also look into a popover which gives all JSON schema details. The solution with the placeholder has indeed a limitation in that you only see the placeholder when the field is empty, not when the field contains About the missing JSON schema fields: can you please open a separate issue to discuss that idea? |
Agree, the switcher doesn't seem very useful after all. I have now opened a separate issue about the missing JSON schema fields: #446 |
Yes that's a bit weird, there is indeed no "real" way to communicate an empty field. You can set it as an empty string for example. |
Added option 'valueDisplayMode' to choose what the node value of a tree should indicate. If set to 'value' (default) it displays the node value, as it used to do. If set to 'schema' and a schema has been defined in the options, it displays the schema type of the node. If set to 'schema-if-null', it only displays the schema type if the value of the node is null.