Allow a form designer to select different renderers in JSON Forms editor based on rankWith tester criteria

Hello,

Looking to extend the JsonForms editor to allow people designing the forms to select from a list of renderers that have been registered based on the tester criteria specified for each renderer.

How can this be achieved ? Is it possible to list multiple renderers that would meet the criteria specified by each tester, and save the name selected by the designer for this field in the UI schema, which will ensure it will be picked up at runtime ?
e.g. logic could be:
rankWith(3, uiTypeIs(“AlternativeRenderer”) /* || some criteria here* /)

Thanks for a great product!
/sf

Hi @sf17,

Yes exactly, you described like we would implement it.

We designed something like this in the past:

  • Enhance the UI Schema by specifying an optional renderer field for each UI Schema element in the UI Schema
    • We did not use the type as suggested because then there would be no fallback for when the UI schema should be used in a context where these renderers are not available. If that is of no concern you could also use the type
  • Register all your alternative renderers so that they “win” when that special property is set
  • Enhance the UI to allow to select the different renderers