rjsf-team/react-jsonschema-form

Allow wildcards for path specification in uiSchema

Open

#3.941 aberto em 8 de nov. de 2023

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (2.136 forks)batch import
featurehelp wanteduiSchema

Métricas do repositório

Stars
 (13.175 stars)
Métricas de merge de PR
 (Mesclagem média 3d 17h) (32 fundiu PRs em 30d)

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.

Guia do colaborador