Swagger-ui with Swagger 2.0 - How to categorize apis

4,466 views
Skip to first unread message

Angeline Loh

unread,
Oct 26, 2014, 8:19:43 AM10/26/14
to swagger-sw...@googlegroups.com
Hello,

I used the Swagger editor to write in YAML which then translate to JSON to be used in SwaggerUI. With the 2.0 definition, it looks great! One little thing I can't seem to find how to do is to have collapsible groups of routes. 
For example, in the pet example, it has 3 main categories - pets, users (and something else). How do you achieve this with a 2.0 compliant json schema?

THanks

Ron

unread,
Oct 26, 2014, 8:28:02 AM10/26/14
to swagger-sw...@googlegroups.com
That's done using the "tags" property for operations - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#operationTags - it's an array of strings containing the groups you want to have for that operation.

The top-level "tags"- https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#swaggerTags- allows you to add additional metadata on the tags and control its UI ordering if you wish.

--
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.

Angeline Loh

unread,
Oct 26, 2014, 8:37:30 AM10/26/14
to swagger-sw...@googlegroups.com
Awesome. Works wonders.

Thanks heaps!

Angeline Loh

unread,
Oct 29, 2014, 8:45:18 PM10/29/14
to swagger-sw...@googlegroups.com
Hi,

Can I have multiple level tag nesting?

------
angeline loh

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/qExwtPD_C1s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.

tony tam

unread,
Oct 29, 2014, 8:49:25 PM10/29/14
to swagger-sw...@googlegroups.com
You can have operations under multiple tags, but not tags under tags.

Angeline Loh

unread,
Oct 30, 2014, 7:00:20 AM10/30/14
to swagger-sw...@googlegroups.com
I see. Can we break the yaml file into smaller yaml files and connect them together?

------
angeline loh

Ron

unread,
Oct 30, 2014, 7:09:13 AM10/30/14
to swagger-sw...@googlegroups.com
What exactly are you trying to achieve?

Angeline Loh

unread,
Oct 30, 2014, 7:12:43 AM10/30/14
to swagger-sw...@googlegroups.com
Sorry, it was actually another question not relating to the first. I have a growing yaml file, is it possible to "modularize" the documentation so to speak?

------
angeline loh

Ron

unread,
Oct 30, 2014, 7:15:03 AM10/30/14
to swagger-sw...@googlegroups.com
Technically, you can split the documentation, but I don't know if that's supported by the swagger-editor project yet. I'd suggest opening an issue on the repository and asking there.
Reply all
Reply to author
Forward
0 new messages