Skip to content

Support 'oneOf' enum titles in array element headers #1621

Open
@low-on-mana

Description

@low-on-mana

Describe the bug
I am trying to add label to enum fields as described in this commit 432af77. Its resulting in weird recursive form.

To Reproduce
Jsonschema:

        "loadBalancer": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "type",
              "threshold",
              "duration",
              "severity"
            ],
            "properties": {
              // 3 other elements as in screenshot
              "severity": {
                "type": "string",
                "oneOf": [
                  {"const": "foo", "title": "Foo"},
                  {"const": "bar", "title": "Bar"}
                ],
                "default": "foo"
              }
            }
          }
        },

UISchema:

            {
              "type": "Control",
              "scope": "#/properties/deployment/properties/alerts/properties/loadBalancer",
              "label": "LoadBalancer alerts",
              "options": {
                "detail": {
                  "type": "VerticalLayout",
                  "elements": [
                    // 3 other elements as in screenshot
                    {
                      "type": "Control",
                      "scope": "#/properties/severity"
                    }
                  ]
                }
              }

Expected behavior
Expected to show usual dropdown with different title and value

Screenshots
Foo, Bar instead of coming as drop down are coming as category fields. And in these categories, my whole form is again inside.

Screenshot 2020-08-10 at 1 36 16 PM

Browser (please complete the following information):

  • Browser [Firefox]
  • Version [79.0]

Used Setup (please complete the following information):

  • Framework: [react]
  • RendererSet: [material]

Additional context
The said enum field is a field contained in array of objects, thats why I am using options->detail.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions