Version: 3.5.1 “@jsonforms/vue-vanilla”: “3.5.1”,
I have this field in my schema:
“kt_land”: { “title”: “KT_Land”, “type”: “integer”,
“oneOf”:[ {“const”: 190, “title”: “Deutschland” },
{“const”: 200, “title”: “Frankreich” } ]
},
but when i select one entry of the drop down list, i get a String of the integer in my json-object:
“kt_land”: “190”,
so i always get an error: “must be integer must match exactly one schema in oneOf”
I am new to the group, so i hope that the describtion of my problem is correct.
so what is the correct way to define an integer enum with a dropdown list of tittles?
Yes, if you get a string in the data, then this means the renderer dispatched the wrong data. It should use the const of the schema it is handed over, instead it’s likely using the value from the input element it is rendering which seems to stringify them.
Thanks for the answer. In the code i also found a difference to the VuetifyControl.
But i do not know hot to open an issue for that.
How can i do this?
thanks for your help, i opened an issue #2450 .
i do not know how a correct solution would look like or how to access the schema.
For me this workaround helped:
target.selectedIndex === 0 ? undefined : ( Number.isNaN(target.value) ? target.value :Number(target.value) )