Skip to content

Add button of array prop does nothing, if array items are anyOf/oneOf #3725

Open
@straygar

Description

@straygar

Prerequisites

What theme are you using?

core

Version

5.8.0

Current Behavior

Given a schema:

{
  "type": "object",
  "required": [
    "root"
  ],
  "properties": {
    "root": {
      "type": "object",
      "properties": {
        "arrayProp": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "default": "abc"
              }
            ]
          }
        }
      }
    }
  }
}

Pressing the "Add" button of arrayProp does nothing.

If I specify "default": null in items, the add button works. I would expect it to default to the first item, which rjsf does if an anyOf/oneOf is not an array item.

Expected Behavior

A new item is created, defaulting to the first value of "anyOf" (null).

Steps To Reproduce

See playground link

original playground link

Environment

- OS:
- Node:
- npm:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions