# How to make UISchema dynamic

**URL:** <https://jsonforms.discourse.group/t/how-to-make-uischema-dynamic/539>\
**Category:** General\
**Created:** [December 23, 2021, 7:22am UTC](https://jsonforms.discourse.group/t/how-to-make-uischema-dynamic/539 "2021-12-23T07:22:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritu](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@ritu](https://jsonforms.discourse.group/u/ritu)\
**Post date:** [December 23, 2021, 7:22am UTC](https://jsonforms.discourse.group/t/how-to-make-uischema-dynamic/539/1 "2021-12-23T07:22:11Z")

</div>

Hi  
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

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [January 3, 2022, 9:41am UTC](https://jsonforms.discourse.group/t/how-to-make-uischema-dynamic/539/2 "2022-01-03T09:41:08Z")

</div>

Hi @ritu,

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

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

```

Of course you could also generate it yourself, the [generator code](https://github.com/eclipsesource/jsonforms/blob/075bbc448cfb2bb209e86d6b1ea6460df23a9f64/packages/core/src/generators/uischema.ts#L115-L202) is just about 100 sparse LOC.

---

<div class="post-metadata">

**Author:** ![ritu](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@ritu](https://jsonforms.discourse.group/u/ritu)\
**Post date:** [January 3, 2022, 10:18am UTC](https://jsonforms.discourse.group/t/how-to-make-uischema-dynamic/539/3 "2022-01-03T10:18:10Z")

</div>

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

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

which has no effect

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [January 3, 2022, 3:02pm UTC](https://jsonforms.discourse.group/t/how-to-make-uischema-dynamic/539/4 "2022-01-03T15:02:18Z")

</div>

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)

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

```
