Hello, I am working on implementing complex json forms for registration page. The problem I have right now is that we need to handle conditional cases in both schema.json and uischema.json (field needs to be marked as required but also shown or hidden in uischema), and it is becoming increasingly more complicated to keep both in sync as project grows. Another issue is that fields that are hidden visually are still populated in data part.
Now I’ve been thinking about fixing all these issues by using custom renderers. If, for example we have if-then-else and through that we decide that some field should not be present in the schema, we would hide it in the renderer code.
The trick is how to figure out if certain field passes if-then-else condition? For example if I have schema like this:
{
"type": "object",
"properties": {
"text1": {
"type": "string"
}
},
"if": {
"properties": {
"text1": {
"const": "abc"
}
}
},
"then": {
"properties": {
"text2": {
"type": "string"
}
}
},
"else": {
"properties": {
"text3": {
"type": "string"
}
}
}
}
Is it possible to run this schema through some built-in function by passing schema and data and then producing some kind of result schema that would look something like this:
"type": "object",
"properties": {
"text1": {
"type": "string"
}
"text2": {
"type": "string"
}
},
so basically, a schema where if-then-else is resolved and then apppended to properties?
Is this something that jsonforms does internally when evaluating if some field should be required or not? Thanks!