jsonforms icon indicating copy to clipboard operation
jsonforms copied to clipboard

Render conditional properties defined in `if`

Open buremba opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

For the following JSON Schema, it would be great if JsonForms could render the elements dynamically given schema:

type: object
if: 
  properties: 
    type: 
      const: CSV 
then: 
  properties:
    record_delimiter:
      default: "\n"
      type: string

Describe the solution you'd like

Render elements when the field matches given value

Describe alternatives you've considered

Move definition to upper level and use required in if or use custom uischema to render schema on the fly.

Framework

React

RendererSet

Material

Additional context

No response

buremba avatar Jan 29 '24 20:01 buremba

Hi @buremba,

That would certainly be a nice feature in general. Such properties could be collected and included in the UI Schema generator and then either have an implied "default rule" or we include the rule in the generation.

Things become much more complicated depending on the behavior of the if, for example if the then/else switches the type of the control. These cases should still be ignored.

Would you like to contribute this extension to the ui schema generator?

sdirix avatar Jan 30 '24 09:01 sdirix