How to generate swagger.json from Java class files and JAX-RS (no running server)?

3,411 views
Skip to first unread message

Charles Capps

unread,
Mar 31, 2017, 3:15:30 PM3/31/17
to Swagger
Hello,
I am thrilled about the great support for generating Swagger from JAX-RS and frameworks like Jersey2. 

However, it would be best for our CI/CD process if it were possible to generate the swagger.json without starting up a local server.

Is there a command line utility to generate swagger given a WAR or Java class files? 

Thanks,
Charles

Ron Ratovsky

unread,
Mar 31, 2017, 4:00:02 PM3/31/17
to swagger-sw...@googlegroups.com

There’s a community maven plugin - https://github.com/kongchen/swagger-maven-plugin.

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

Charles Capps

unread,
Mar 31, 2017, 4:01:49 PM3/31/17
to Swagger
Thanks! I'm going to try this out right now.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Charles Capps

unread,
Mar 31, 2017, 7:26:35 PM3/31/17
to Swagger
Thanks, the swagger-maven-plugin works great. I was stumped for a little while as to why the exact same code wasn't generating swagger.json correctly; it turns out that this plugin requires the @ApiOperation annotations on your endpoints, even though I don't see this mentioned in the documentation. With swagger-core jersey-jaxrs it works without those annotations.

Arthur De Magalhaes

unread,
Apr 1, 2017, 5:02:38 PM4/1/17
to Swagger
There's also this maven plugin:  https://github.com/WASdev/tool.swagger.docgen
Reply all
Reply to author
Forward
0 new messages