Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render conditional properties defined in if #2262

Open
buremba opened this issue Jan 29, 2024 · 1 comment
Open

Render conditional properties defined in if #2262

buremba opened this issue Jan 29, 2024 · 1 comment

Comments

@buremba
Copy link

buremba commented Jan 29, 2024

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

@sdirix
Copy link
Member

sdirix commented Jan 30, 2024

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 sdirix added this to the next milestone Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants