Skip to content

"Allow Empty Value" only works before you select then unselect something from the array list #10941

Description

@tthornton3-chwy

Q&A (please complete the following information)

  • OS: ALL
  • Browser: ALL
  • Version: ALL
  • Method of installation: ALL
  • Swagger-UI version:Latest/5.32.8
  • Swagger/OpenAPI version: Swagger 2 OpenAPI 3.1

Content & configuration

Allow empty only works once. If you select something from the list, and unselect, the empty query parameter does not get attached.

Example Swagger/OpenAPI definition:

{
                        "name": "status",
                        "in": "query",
                        "description": "Find Something. Send status= to clear the status filter.",
                        "style": "form",
                        "explode": true,
                        "allowEmptyValue": true,
                        "schema": {
                            "anyOf": [
                                {
                                    "type": "array",
                                    "items": {
                                        "type": "string",
                                        "description": "Something",
                                        "enum": [
                                            "FOO",
                                            "BAR"
                                        ]
                                    }
                                },
                                {
                                    "type": "null"
                                }
                                
                            ]
                        }
                    },

Swagger-UI configuration options:
Defaults.

To reproduce...

Steps to reproduce the behavior:

  1. Have an api-doc similar/including to what I shared above.
  2. Check the "Allow Empty" checkbox
  3. Send a request and see that it works / status= is sent.
  4. Select then unselect any item in the list. It should be empty again.
  5. See that status= is NOT sent.

Expected behavior

status= should continue to be sent after selecting/unselecting everything.

Screenshots

Image

Additional context or thoughts

I have already fixed this here: #10940 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions