How to make UISchema dynamic

I have initially some static JSON data & uischema. Now few fields are dynamic so how can I add uischema to dynamic controllers

Basically is there any way to generate uischema dynamically

Hi @ritu,

you can invoke the built-in UI Schema generator like this:

import { Generate } from '@jsonforms/core';
const uischema = Generate.uiSchema(schema);

Of course you could also generate it yourself, the generator code is just about 100 sparse LOC.


Thanks a lot !! & also can we make these fields optional

Cause am doing Generate.jsonSchema(tempJson, {additionalProperties: {required: false}})

which has no effect

You can just iterate over the generated schema and remove all required fields.

In case you would like to use the generation options instead I think the following should work (untested)

Generate.jsonSchema(json, { required: () => [] } );