Skip to content

Multi selection of query parameters with array of enum #8583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cornerman opened this issue Apr 20, 2023 · 4 comments
Open

Multi selection of query parameters with array of enum #8583

cornerman opened this issue Apr 20, 2023 · 4 comments
Labels
needs: UX/design input P3 pull-request-welcome If a PR were to be made, we would help get it merged type: bug

Comments

@cornerman
Copy link

cornerman commented Apr 20, 2023

Content & configuration

Swagger/OpenAPI definition:

openapi: 3.0.0
info:
title: Multi-value array parameter
version: 0.0.1
paths:
/something:
  post:
    parameters:
      - name: paramTypes
        in: query
        schema:
          type: array
          items:
            type: string
            enum:
              - number
              - string
              - boolean
              - date

Is your feature request related to a problem?

With the above configuration, I will get a form in the swagger ui like this:
2023-04-20_17-30-41-

While this works to select single or multiple enum values, I cannot select the same value multiple times. It basically just allows sending a set of values. But in my case, there is the use-case of sending, e.g., a combination like this number,number,string,string as query parameters. But the UI does not let me select this - while it would be supported by the openapi spec and by the backend.

Describe the solution you'd like

I would like to specify that I want to have duplicates in my enum array and specify an order, which should give me a UI similar to what happens, when I would just use a plain string instead of enum in my schema. Like here:
2023-04-20_17-34-52-

I could not find anything in the docs, that would configure this.

Describe alternatives you've considered

My current workaround is to accept any string and parse it in the backend - without providing a proper schema in the openapi spec. But I would like to change that :)

@anreton
Copy link

anreton commented Aug 12, 2024

We have also recently encountered this limitation(((

As a temporary solution, we simply ignore the current display of this parameter in Swagger UI.

@swarnika-gupta
Copy link

Is this problem addressed? I am also facing the same issue.

@ponelat ponelat added type: bug P3 needs: UX/design input pull-request-welcome If a PR were to be made, we would help get it merged labels Feb 21, 2025
@lamuertepeluda
Copy link

Hi there, I have the same problem using "swagger-ui-dist": "^5.20.0".
In my case, the select dropdown doesn't even work. I click on it but nothing happens.

@bkarnecki
Copy link

👀 bump.
I would like to see something line this:
@parameter(name = "partnerTypes",
description = "Filter by partner types",
schema = @Schema(type = "array",
items = @Schema(type = "string",
allowableValues = {"Z", "X",
"Y", "V"}))),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: UX/design input P3 pull-request-welcome If a PR were to be made, we would help get it merged type: bug
Projects
None yet
Development

No branches or pull requests

6 participants