I have a big form with few objects inside that are used more than once (in json schema by $ref) and I need to provide them in uiSchema options to render them in the same way. Is there a way to provide this options once?
[original thread by Wojciech Tutro]
Hi @wtutro(wtutro), in general we don’t support something similar to
$ref in the ui schema. I see three possibilities to reduce your ui schema size and effort:
The simplest one would be to adapt your ui schema programmatically. You can just define your own reusable options approach and resolve them before handing them over to JSON Forms. This way you can avoid repeating yourself all over while also keeping full flexibility. This should be possibly with very little effort.
What might also be applicable is the
config object. When you hand over a
config object to your
JsonForms component, then this
config will be mixed in all ui schema element options, with the ui schema element options having higher priority. Note that this ‘mixed’ in options object is only available at render time and will therefore not be applied to the ui schema received by testers. Also it will be mixed in with ALL ui schema elements which might not be what you want.
When you have so many ui schema options which are the same then it might be worth it to not configure them via the ui schema but encoding them in a custom renderer. You can then still specify variances via the ui schema, should the default options not fit for a specific element.
Many thanks for You answer @sdirix(sdirix). I will check Your options and try to apply to my needs!