programmatically add swagger - no swagger annotations

85 views
Skip to first unread message

Carlos Estrada

unread,
Oct 6, 2015, 2:56:42 PM10/6/15
to Swagger
Hi,

I'm creating a REST service, using dropwizard 0.8.4.
The resources I'm creating are programmatic build, see https://jersey.java.net/documentation/latest/resource-builder.html

Since the resources does not have any annotations, how do I Swagger-enable my REST service?

tony tam

unread,
Oct 6, 2015, 3:38:08 PM10/6/15
to Swagger
Hi Carlos, why in fact yes, you can do that.  This project:


both supports the Jersey resource builder and has support for DropWizard.  Try it out and I'd love to get your feedback.  It treats the swagger specification as the single source of truth for the routes.

Tony

Carlos Estrada

unread,
Oct 7, 2015, 3:32:33 AM10/7/15
to Swagger
Hi tony,

Thanks for you advise but it seems that the project is not production redy, it status is "in preview".

Then I really did not get how to swagger-enable, since I do not have a controller class nor model class (all is done programmatically) and I also want to use jersey2.

tony tam

unread,
Oct 12, 2015, 12:03:14 AM10/12/15
to Swagger
It should be released shortly.  However I don't know that it'll fulfill your needs.  If you want to programmatically build a Swagger POJO from your routes, it's not hard to do, and if you expose it from your routing logic it'll appear as expected.

So my suggestion is either to look into inflector or add similar logic yourself to your app.  Does that make sense?
Reply all
Reply to author
Forward
0 new messages