swagger-api / swagger-api/swagger-ui
Multi selection of query parameters with array of enum
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
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:

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:

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 :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the OpenAPI query parameter example in Swagger UI and start by tracing the form handling for array parameters with enum items. Done means the UI can accept duplicate enum values in a chosen order and the generated request preserves those repeated values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100