swagger-ui: Swagger UI doesn't seem to support Arrays yet?
Hey there,
Please excuse my relative ignorance, I’m using Swagger within the context of a rails app and I’m not particularly up to date with where swagger’s UI is in comparison with swagger’s spec. I wanted to ask, has the UI implemented the Array type? I want to be able to define an API with parameters that would resolve to this in the API:
foo[]=1&foo[]=2&foo[]=3
In grape-swagger-rails I’m able to define a parameter as such:
requires :foo, type: Array[Integer], desc: 'An Array of Foos'
grape-swagger-rails (I think it’s that gem which does this) renders the following JSON spec:

And Swagger UI renders the output like this:

When it queries the API, it generates the following url:
http://localhost/example?foo=1
Which of course works, but isn’t helpful for allowing people to test.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 24 (11 by maintainers)
That’s not the right definition for an array. You need to end up with something that looks like:
I have just ran into this issue on master. Is it possibly a regression?
Swagger UI takes whatever I put into the text area and url encodes it into a single parameter. It should be multiple parameters with the same name. See screenshots below.
Hi @fehguy, thanks for your answer, but I know the standards. For example:
I should be able in UI to put in devices fileld values: “1&2&3” or “1,2,3” and the post parameters should look like: devices: 1 devices: 2 devices: 3 but currently it looks like “devices: 1,2,3”
Take a look here @johnhamelink :
https://github.com/swagger-api/rails-petstore