Skip to content

oneOf with objects containing null object refuses the selection of the null option #4896

@augruber

Description

@augruber

Prerequisites

What theme are you using?

shadcn

Version

6.1.0

Current Behavior

I have the following schema:

{
  "type": "object",
  "title": "Configuration",
  "oneOf": [
    {
      "title": "Default Configuration",
      "type": "object",
      "properties": {
        "types": {
          "const": "default",
          "title": "Types"
        },
        "content": {
          "type": "string",
          "title": "Content"
        }
      },
      "required": [
        "types"
      ]
    },
    {
      "title": "Advanced Configuration",
      "type": "object",
      "properties": {
        "types": {
          "const": "advanced",
          "title": "Types"
        },
        "content": {
          "type": "string",
          "title": "Content"
        }
      },
      "required": [
        "types"
      ]
    },
    {
      "title": "No Configuration",
      "type": "null"
    }
  ],
  "default": {
    "types": "advanced",
    "content": "placeholder"
  }
}

See playground
Note: We set "Object fields default behavior" to option "Assign value to formData when only default is set"

Current Behaviour:
No Configuration can not be selected from the dropdown.

Expected Behavior

No Configuration can be selected from the dropdown.

Steps To Reproduce

  1. Open the playground link
  2. Set "Object fields default behavior" to option "Assign value to formData when only default is set"
  3. In the resulting form, try to set the Configuration to No Configuration

Environment

- Browser: Chrome

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions