rjsf-team/react-jsonschema-form

Allow wildcards for path specification in uiSchema

Open

#3,941 建立於 2023年11月8日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)TypeScript (13,175 star) (2,136 fork)batch import
featurehelp wanteduiSchema

描述

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.

貢獻者指南