swagger-api / swagger-api/swagger-ui

`format`s of query parameters are not shown for array-type parameters

Open
#4,516 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

cat: rendering type: bug
Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q A
Bug or feature request? bug
Which Swagger/OpenAPI version? any
Which Swagger-UI version? 3.14.0
How did you install Swagger-UI? dist/
Which browser & version? any
Which operating system? any
Demonstration API definition
{
  "swagger": "2.0",
  "paths": {
    "/v1/log/login/search": {
      "get": {
        "produces": [
          "application/json;charset=utf-8"
        ],
        "parameters": [
          {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "in": "query",
            "name": "targetUserIds",
            "collectionFormat": "multi",
            "type": "array",
            "description": "`UserId` | `uuid`"
          }
        ]
      }
    }
  }
}
Configuration (browser query string, constructor, config.yaml)
{
  displayRequestDuration: true,
  tagsSorter: 'alpha',
  operationsSorter: 'alpha',
  showCommonExtensions: true,
  url: window.location.origin + "/swagger.json",
  dom_id: '#swagger-ui',
  deepLinking: true,
  presets: [
    SwaggerUIBundle.presets.apis,
    SwaggerUIStandalonePreset
  ],
  plugins: [
    SwaggerUIBundle.plugins.DownloadUrl
  ],
  layout: "StandaloneLayout"
}

No query string.

Expected Behavior

Array-type parameters’ formats being rendered somewhere.

Current Behavior

After #4245 and #4231, formats are shown correctly for non-array query parameters. However array ones get just array[string], which is not what is defined in the API above:

screenshot-20180504-142944

/cc @heldersepu @hkosova @shockey

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Swagger UI's parameter rendering using the demonstration Swagger 2.0 definition, focusing on an array query parameter whose item has format uuid. Compare it with the existing non-array format behavior and verify that the rendered array parameter exposes the item format rather than only array[string].

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.