Skip to content

When choose the "--" item for enum array, the parameter is sent with empty value. #5971

@tedyu002

Description

@tedyu002

#5095 # Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: chrome
  • Version: 80.0.3987.163
  • Method of installation: dist assets
  • Swagger-UI version: 3.25.0
  • Swagger/OpenAPI version: OpenAPI 3.0.2

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.2
info:
  title: API
  description: API
  version: '0.1'
paths:
  /function:
    get:
      parameters:
        - description: items
          required: false
          schema:
            title: item
            type: array
            items:
              enum:
                - first_item
                - second_item
              type: string
            description: item
          name: item
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: string

Swagger-UI configuration options:

    const ui = SwaggerUIBundle({
        url: '/openapi.json',
    oauth2RedirectUrl: window.location.origin + '/docs/oauth2-redirect',
        dom_id: '#swagger-ui',
        presets: [
        SwaggerUIBundle.presets.apis,
        SwaggerUIBundle.SwaggerUIStandalonePreset
        ],
        layout: "BaseLayout",
        deepLinking: true
    })
?yourQueryStringConfig

Describe the bug you're encountering

When choose "--" of the multiple-select box (produced by enum Array).
The parameter should not be in the query string, but "item=" is in the query string.

To reproduce...

Steps to reproduce the behavior:

  1. Go to /function
  2. Click on "--" in the item parameter
  3. Execute
  4. See error

Expected behavior

no item in the query string.

Screenshots

editor swagger io_

Additional context or thoughts

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