Skip to content

How do I eliminate the select dropdown when using anyOf? #4469

@zeckdude

Description

@zeckdude

Prerequisites

What theme are you using?

core

What is your question?

I have this example schema in the playground:

{
  "title": "A registration form",
  "description": "A simple form example.",
  "type": "object",
  "required": [
    "firstName",
    "lastName"
  ],
  "properties": {
    "ipAddresses": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "format": "ipv4"
          },
          {
            "type": "string",
            "format": "ipv6"
          }
        ]
      }
    }
  }
}

I'm trying to collect multiple IP addresses but when it shows the UI elements, it shows the text field (which I want) but it also shows a dropdown with Option 1 and Option 2 as the options (which I don't want). How can I remove that dropdown?

As a bonus, how can I implement validation based on the fact that this field should be an IP address?

As a second bonus, how can I set the section titles and field titles so it sounds more natural? Do I need to set that in the UI schema or in the JSON schema?

Image

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