default values for each of the oneOf options are not displayed
See original GitHub issueGeneral information
When a property is set as oneOf
and each of the value option sets a default value, json-editor shows empty values either for the default option or switching to alternative options. Basically the default value settings are not used at all when oneOf
is set.
Additionally, the title of the item is also fixed as the JSON key name, rather than using the title field of the property.
See below direct link to example
- json-editor version: 2.6.1
Expected behavior
for the default option (“string”), display the string-type default value “DP”, when switching to “integer”, sets to 5 instead
Actual behavior
choosing either option, the default value stays at empty
Steps to reproduce the behavior
{
"title": "MCX JSON Input",
"type": "object",
"required": [
"SaveDataMask"
],
"format": "categories",
"properties": {
"SaveDataMask": {
"oneOf": [
{
"title": "Save detected photon flags",
"type": "string",
"default": "DP"
},
{
"title": "Save detected photon flags",
"type": "integer",
"default": 5,
"minimum": 0
}
]
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Default value not displayed in "Select List" field with two contexts
Hi,. This seems to be a bug with JIRA: I added 2 "Select List" custom fields to the "Resolve Issue" screen for a...
Read more >reactjs - MUI Object in Select default value not showing but ...
The easiest way to use Select is for your value to be a string and your options to each have a label and...
Read more >select-options default values - SAP Community
Hi. To assign default values to a selection criterion, you use the following syntax: SELECT-OPTIONS <seltab> FOR <f> DEFAULT <g> [TO <h>] ....
Read more >3 Ways to Set Default Value in JavaScript | SamanthaMing.com
The better solution with ES6 Default Parameters. function(name = 'no name') { } · Logical Operator ||. This is great if you want...
Read more >Setting the Yes/No field's default value to None - ServiceNow
Hi Team, I have a catalog item with Yes/No as one of the field type. For this field we have also enabled 'Include...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
on a side note - we wrote a web-GUI for a cloud-computing based simulator, where JSON editor was a key component in the frontend. This work was was recently published at https://doi.org/10.1117/1.JBO.27.8.083008, where we referenced the json-editor project. here is our web GUI: http://mcx.space/cloud/
json-editor really made our development much simpler, we want to thank the developers for your great works!
Thank you for the detailed response. I am using workaround no 1, because of a related issue. I choose a subschema in a
anyOf
and would like the defaults to be overwritten. As this does not work (it only overwrites changing properties) I can use your hack to force an initial selection.