How to ignore @Api and @ApiOperation?

1,889 views
Skip to first unread message

J List

unread,
Apr 20, 2015, 7:31:44 PM4/20/15
to swagger-sw...@googlegroups.com
Greetings all!

I'm new to swagger. I'm trying out swagger-jersey-jaxrs 1.5.3-M1 Jersey 1.x integration. I was able to create a new servlet following the wiki on github and annotate a few classes with @Api and some API methods with @ApiOperation. They show up in the /swagger.json served by the servlet. The first thing we notice that there are a few "internal" APIs that are also showing up. They are derived classes from the "public" API classes and I think that's how they get the @Api and @ApiOperation annotation indirectly. But we don't want the internal APIs to show up in API documentation. I wonder if there is anyway to hide them? I'm imagining something like @ApiIgnore on class and method?

Thanks,
Jack

Ron Ratovsky

unread,
Apr 21, 2015, 5:43:29 AM4/21/15
to swagger-sw...@googlegroups.com
Both @Api and @ApiOperation have a boolean `hidden` property which you can use to hide it.

Another option, if you want have a separate internal and external documentation is to use the spec filter to choose what's exposed to who.

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



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

jlist9

unread,
Apr 21, 2015, 3:08:33 PM4/21/15
to swagger-sw...@googlegroups.com
Thanks Ron! @Api(hidden=true) works great. I'll also look into the spec filter option.
Reply all
Reply to author
Forward
0 new messages