UISchema: Can a schema be split in to multiple files?

I have a very large uischema which I’d love to be able to split out in to logic subfiles i.e.

  • uischema.json
  • Category1.josn
  • Category2.json
  • Category3.json

I’ve tried using $ref as you’d expect to in a JSON schema but I didn’t have much luck i.e.

uischema.json

{
  "type": "Categorization",
  "elements": [
    {
      "type": "Category",
      "label": "Set-up",
      "$ref": "file:src/json/vehicles/uischema/set-up-schema.json"
    }
  ]
}

set-up-schema.json

{
  "elements": [
    {
      "type": "Group",
      "label": "Set-up",
      "elements": [
        {
          "type": "Control",
          "scope": "#/properties/Setup/properties/setup/properties/item1"
        },
        {
          "type": "Control",
          "scope": "#/properties/Setup/properties/setup/properties/item2"
        }
      ]
    }
  ]
}

Is it possible to split it out in to logic units?

NB. the files are all stored in the same folder on src/json/vehicles/uischema/

Cheers,

Rob.

Hi @robg,

We don’t have built-in support for refs in UI Schemas. You could either resolve them yourself before handing over the UI Schema to JSON Forms, or you implement custom renderers which are able to resolve the UI Schemas at runtime and use them for rendering.

1 Like

Many thanks, I’ll take a look in to it :+1: