Enable displaying a node schema type instead of its value#445
Enable displaying a node schema type instead of its value#445ofrebourg wants to merge 2 commits intojosdejong:developfrom
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.