swagger enum values

645 views
Skip to first unread message

Imran Rashid

unread,
Jun 26, 2014, 1:26:32 PM6/26/14
to scalat...@googlegroups.com

Hi,

I've just started using both Scalatra and Swagger.  I've managed to the get the basics working, but I can't figure out how to get enums working as input parameters.  eg., for the petstore example, the "status" param to /pets/findByStatus should take an enum:

http://petstore.swagger.wordnik.com/api/api-docs/pet

I saw @ApiEnum, but it doesn't seem to be used anywhere.  I tried guessing where to put it in, but no luck.  Any guidance on enums?

thanks,
Imran

Ivan Porto Carrero

unread,
Jun 26, 2014, 1:33:05 PM6/26/14
to scalat...@googlegroups.com

---
Met vriendelijke groeten - Best regards - Salutations
Ivan Porto Carrero - Mob: +1 (415) 323-8084
Web: http://flanders.co.nz
Twitter: http://twitter.com/casualjim



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

Imran Rashid

unread,
Jun 27, 2014, 12:55:23 PM6/27/14
to scalat...@googlegroups.com
hmm, thanks for pointing me to that, too bad.

I take it there is also no solution with java enums, or even just a manually specified list of options?  eg. something like

queryParam[String]("status") enumValues("available", "pending", "sold")

Imran Rashid

unread,
Jul 2, 2014, 6:06:43 PM7/2/14
to scalat...@googlegroups.com

maybe I wasn't clear what I wanted in my original message, but it is actually already possible.  In case anybody else is looking for this, if you want to manually give a list of allowed values for a parameter, you can use the allowableValues method:

queryParam[String]("status") allowableValues("available", "pending", "sold")
Reply all
Reply to author
Forward
0 new messages