Re: How to specify an array parameter in swagger-docs?

741 views
Skip to first unread message

Tony Tam

unread,
Aug 5, 2014, 2:04:46 PM8/5/14
to Pish Vindas, swagger-sw...@googlegroups.com
Hi Pish, take a look at our full rails sample here:


It’s fully compliant with the swagger specification.
-- 
Tony Tam
Sent with Airmail

On August 4, 2014 at 10:08:02 AM, Pish Vindas (rvi...@acronymcr.com) wrote:

Hi, I'm using swagger-docs in a Ruby on Rails application. I have a swagger_model called Disk and this is the parameter I am specifying in the corresponding swagger_api entry:

param :body, :disks, :Disk, :optional, "An array of disks"

How could I make this parameter an array in order to behave like this example: http://petstore.swagger.wordnik.com/#!/user/createUsersWithArrayInput ?

Thanks in advance
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rolando Vindas

unread,
Aug 5, 2014, 2:32:10 PM8/5/14
to Tony Tam, swagger-sw...@googlegroups.com
Thanks Tony!

Yes, that example along with the swagger specification plus some trial and error were vital to solve my issue. I had to convert all the params into a swagger_model.

Just in case this helps someone else with the same situation, using swagger-docs this was the line I ended up with in the model:

...
property :disks, :array, :optional, "A list of disks", { "items" => { "$ref" => "Disk" } }
...

Regards

Xiaoyi Tian

unread,
Nov 17, 2014, 6:42:32 PM11/17/14
to swagger-sw...@googlegroups.com, feh...@gmail.com
Thank you Pish, 

This is exactly what I need. 
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages