rjsf-team/react-jsonschema-form

Allow wildcards for path specification in uiSchema

Open

#3941 opened on Nov 8, 2023

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (13,175 stars) (2,136 forks)batch import
featurehelp wanteduiSchema

Description

Prerequisites

What theme are you using?

mui

Is your feature request related to a problem? Please describe.

I autogenerate large schemas, which may be nested. For these, I need to customize the uiSchema, let's say for all properties with a specific key. Currently the uiSchema would look for example like this:

{
  "nested-1": {
    "items": {
      "someArray": {
        "ui:widget": "checkboxes"
      }
    }
  },
  "nested-2": {
    "items": {
      "someArray": {
        "ui:widget": "checkboxes"
      }
    }
  },
  "deeply-nested": {
    "items": {
      "deeply-nested-inside": {
        "items": {
          "someArray": {
            "ui:widget": "checkboxes"
          }
        }
      }
    }
  },
  "someArray": {
    "ui:widget": "checkboxes"
  }
}

Describe the solution you'd like

It would help readability a lot if I could simply tell the uiSchema: "Apply this ui option to all elements matching some rule." Maybe something like this:

{
  "#/someArray": {
    "ui:widget": "checkboxes"
  }
}

Or some other wildcard mechanism...

Describe alternatives you've considered

Using an external JSON parser might be able to generate the original uiSchema, but the result would still be very verbose and hard to modify after creation.

Contributor guide