swagger-api / swagger-api/swagger-ui
No support for nested arrays in query parameters?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
What I want to do i essentially this: ?where[]=user,1&where[]=section,7
After a bit of tinkering and and checking out what was discussed on Swagger Google Group a while ago, I arrived at the following implementation:
"parameters": [
{
"name": "where[]",
"in": "query",
"description": "Filter by attribute value",
"required": false,
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
"collectionFormat": "multi"
}
],
I guess, the problem is swagger-ui relies on line breaks to identify array items in the textarea field. It will correctly recognize only the top-level array, but everything else (in my case, commas) will be url encoded and ignored. Is there a way to circumvent this? Am I even doing it correctly?
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
Start by reproducing the supplied nested-array query parameter definition and request in Swagger UI, then trace how the textarea input is converted into query values and URL encoding. Done means nested array items are represented and serialized as intended rather than being treated as top-level lines with encoded commas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100