I have a property in my JSON schema like this:
"properties": {
"theme": {
"type": "boolean",
"title": "Theme",
"enum": ["Light", "Dark"]
}
}
This property is stored in my database table as a boolean, with 1 for light, 0 for dark. The problem is that when I fill out the form generated by the schema it errors, telling me that the value of root.theme must be one of [true, false] and won't proceed to my backend handler.
There is a solution I found that I'm currently utilising, which is changing the "type" to string, and handling it on the backend side, by converting the string value I receive into the boolean corresponding to it.
I am wondering whether JSON schema natively supports custom naming for true & false in a boolean property.
true
andfalse
are their own values. I don't know what you mean by "custom naming". Can you expand on this please? – RelequestualLight|Dark
and the system gett|f
– Ivan T.