Skip to content
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

allowMultiple not working with Swagger UI? #487

Closed
gbisaga opened this issue Jul 5, 2014 · 1 comment
Closed

allowMultiple not working with Swagger UI? #487

gbisaga opened this issue Jul 5, 2014 · 1 comment

Comments

@gbisaga
Copy link

gbisaga commented Jul 5, 2014

Hi, I am wondering if allowMultiple is a working (or recommended) way to document an API using swagger UI. I am creating a new API that originally used a repeating query string parameter to support rails/PHP/HTML style (http://server/resource?foo[]=a&foo=b).

Then I found this was not supported in Swagger, so I changed it to use allowMultiple and comma-separated syntax (http://server/resource?foo=a,b).

So, I documented my API:

                  {
                     "name":"geography",
                     "description":"Geography values to return",
                     "required":false,
                     "type":"integer",
                     "paramType":"query",
                     "allowMultiple":true
                  },

But the swagger UI only displays a single text box. I have tried putting a space and a comma in the input field, but swagger UI URL encodes these and passes them. Is there any way to make the UI either display multiple boxes or (more likely) understand a separator string?

@fehguy
Copy link
Contributor

fehguy commented Jul 11, 2014

you need to specify the allowable values. Can you please look at this sample:

http://petstore.swagger.wordnik.com/#!/pet/findPetsByStatus

and the associated json:

{
  "parameters": [
    {
      "name": "status",
      "description": "Status values that need to be considered for filter",
      "defaultValue": "available",
      "required": true,
      "type": "string",
      "paramType": "query",
      "allowMultiple": true,
      "enum": [
        "available",
        "pending",
        "sold"
      ]
    }
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants