swagger-api / swagger-api/swagger-ui
"Allow Empty Value" only works before you select then unselect something from the array list
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
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:
- Have an api-doc similar/including to what I shared above.
- Check the "Allow Empty" checkbox
- Send a request and see that it works /
status=is sent. - Select then unselect any item in the list. It should be empty again.
- See that
status=is NOT sent.
Expected behavior
status= should continue to be sent after selecting/unselecting everything.
Screenshots
Additional context or thoughts
I have already fixed this here: https://github.com/swagger-api/swagger-ui/pull/10940 :)
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
Review pull request #10940 and reproduce the issue with the provided Swagger/OpenAPI definition. Start by checking the Allow Empty flow for an array query parameter, then verify that selecting and unselecting all values still sends status= as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100