Dynamic schema and UI schema fields

Hello,

I have a use case where I have a base schema and a number of UI schemas using it. I want to be able to layer on top of the schema a number of schema extensions, let’s say for each country I want to add a few country specific fields. Then, I’d like to go to the UI schemas and add some of these new fields in the proper country context to any of the base UI schemas. I can generate both schema and UI schema from my existing model and UI model on the fly, but I was wondering if there’s any support to do this directly in jsonForms, and also to what degree this would be possible in jsonforms-editor.

Thanks,
/sebi

1 Like

Hi @sf17,

in JSON Forms we have a UI Schema generator which produces a UI Schema for a JSON Schema. Many users rely on this mechanism and some global configuration instead of providing a UI Schema for each form. The generator is relatively simplistic and will just generate a vertically aligned form with a “control” for each property in the JSON Schema.

Nested schemas (i.e. nested objects and arrays) are then handled by the respective Object or Array renderer. Typically they just use the generator again, and repeat the process for their subschema.

Depending on your exact requirements you can either generate the full UI schema beforehand, for example by reusing the generator or copying and modifying it (see this question for more information), use the UI Schema registry to pass in your detailed UI Schemas, or register custom renderers which adapt to your country specific needs.