Support for lazy recursive JSON schemas
lordrip opened this issue ยท 2 comments
-
Motivation why you'd like to see this in uniforms.
In case there's a recursive JSON Schema, it would be nice to support lazy evaluation of such schema from theJSONSchemaBridge
class -
Examples of how others could use this feature.
Offering a mechanism to initializeJSONSchemaBridge
up to a certain recursion level would allow rendering only up to a level of nested form elements.
Hi team, I saw another similar issue closed about supporting lazy recursive schemas #596, but I'm not sure if managed to get a consensus about how to implement such capability.
Considering the following schema (this is a simplified version of a more complex one)
{
"$schema": "https://json-schema.org/draft-04/schema#",
"type": "array",
"items": {
"maxProperties": 1,
"definitions": {
"org.apache.camel.model.OnExceptionDefinition": {
"type": "object",
"properties": {
"steps": {
"type": "array",
"items": {
"$ref": "#/items/definitions/org.apache.camel.model.ProcessorDefinition"
}
}
}
},
"org.apache.camel.model.ProcessorDefinition": {
"type": "object",
"maxProperties": 1,
"properties": {
"aggregate": {
"$ref": "#/items/definitions/org.apache.camel.model.AggregateDefinition"
}
}
},
"org.apache.camel.model.AggregateDefinition": {
"type": "object",
"properties": {
"aggregation-strategy": {
"type": "string"
},
"steps": {
"type": "array",
"items": {
"$ref": "#/items/definitions/org.apache.camel.model.ProcessorDefinition"
}
}
},
"required": [
"aggregation-strategy"
]
}
},
"properties": {
"on-exception-recursive": {
"$ref": "#/items/definitions/org.apache.camel.model.OnExceptionDefinition"
}
}
}
}
you can see that there's a recursive property from:
aggregate -> steps -> aggregate -> steps
The idea would be to either limit the nested level up to point or to offer a lazy mechanism to render level by level depending on the user interaction.
I was checking the JSONSchemaBridge#getInitialValue but is not clear to me where to place a limit or even if this is the best place to do such thing.
Thanks in advance for the help ๐
Hi @Monteth, this is great ๐.
In a couple weeks I need to work on custom fields to kinda have a workaround. In the meantime, please let me know if I can help somehow, I have a recursive schema to try out as well (although the recursive schema from your PR seems more than good to test it out)
Thanks for the response