How to generate swagger doc from annotations

224 views
Skip to first unread message

Arthur De Magalhaes

unread,
Jul 22, 2015, 7:09:02 PM7/22/15
to Swagger
Hi,

I downloaded the swagger-core modules from GitHub, and I can see the annotations in swagger-core-master\modules\swagger-annotations.

I can also see the models that map to those annotations in swagger-core-master\modules\swagger-core.

However, I don't see any entry point (like a main method I can invoke from command line). So, are there any sample java code that triggers the annotation processing and outputs the resulting swagger.json?

Another question:  I noticed the wiki from swagger-core references javadocs for annotations that are in the package "com.wordnik.swagger.annotations", while the code itself has the same annotations in package "io.swagger.annotations".  Is that just a pre-2.0 vs 2.0 version difference?

Thanks,
Arthur

Kevin

unread,
Jul 27, 2015, 1:19:30 PM7/27/15
to Swagger, ademag...@gmail.com
I also have this question.

Arthur De Magalhaes

unread,
Jul 30, 2015, 11:13:53 AM7/30/15
to Swagger, ademag...@gmail.com
Anyone can help?  Just looking for a way to trigger the creation of a swagger.json, given a set of of annotated java classes. Is there a main entry point, or factory to call?

Thanks.

Ron Ratovsky

unread,
Jul 30, 2015, 11:38:13 AM7/30/15
to Swagger, ademag...@gmail.com
The creation of the swagger.json based on the annotations is done at runtime as long as integrate swagger-core in your application.
If you're looking for an 'offline' generation, you'd need to look into the 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.



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

Kevin

unread,
Aug 3, 2015, 4:50:51 PM8/3/15
to Swagger
Could you please elaborate? After I add the annotations, what would I need to do with the swagger codegen to create the spec/swagger.json file?

Thanks.


On Thursday, July 30, 2015 at 8:38:13 AM UTC-7, Ron wrote:
The creation of the swagger.json based on the annotations is done at runtime as long as integrate swagger-core in your application.
If you're looking for an 'offline' generation, you'd need to look into the swagger-maven-plugin.
On Thu, Jul 30, 2015 at 11:13 AM, Arthur De Magalhaes <ademag...@gmail.com> wrote:
Anyone can help?  Just looking for a way to trigger the creation of a swagger.json, given a set of of annotated java classes. Is there a main entry point, or factory to call?

Thanks.


On Wednesday, 22 July 2015 19:09:02 UTC-4, Arthur De Magalhaes wrote:
Hi,

I downloaded the swagger-core modules from GitHub, and I can see the annotations in swagger-core-master\modules\swagger-annotations.

I can also see the models that map to those annotations in swagger-core-master\modules\swagger-core.

However, I don't see any entry point (like a main method I can invoke from command line). So, are there any sample java code that triggers the annotation processing and outputs the resulting swagger.json?

Another question:  I noticed the wiki from swagger-core references javadocs for annotations that are in the package "com.wordnik.swagger.annotations", while the code itself has the same annotations in package "io.swagger.annotations".  Is that just a pre-2.0 vs 2.0 version difference?

Thanks,
Arthur

--
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-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Aug 3, 2015, 4:53:22 PM8/3/15
to Swagger
You've got the projects confused.

swagger-codegen consumes Swagger definitions.
swagger-core produces them.

You'd need to integrate swagger-core with your application, or use other mechanism such as the swagger-maven-plugin and such.

On Mon, Aug 3, 2015 at 4:50 PM, Kevin <kevin.ch...@gmail.com> wrote:
Could you please elaborate? After I add the annotations, what would I need to do with the swagger codegen to create the spec/swagger.json file?

Thanks.

On Thursday, July 30, 2015 at 8:38:13 AM UTC-7, Ron wrote:
The creation of the swagger.json based on the annotations is done at runtime as long as integrate swagger-core in your application.
If you're looking for an 'offline' generation, you'd need to look into the swagger-maven-plugin.
On Thu, Jul 30, 2015 at 11:13 AM, Arthur De Magalhaes <ademag...@gmail.com> wrote:
Anyone can help?  Just looking for a way to trigger the creation of a swagger.json, given a set of of annotated java classes. Is there a main entry point, or factory to call?

Thanks.


On Wednesday, 22 July 2015 19:09:02 UTC-4, Arthur De Magalhaes wrote:
Hi,

I downloaded the swagger-core modules from GitHub, and I can see the annotations in swagger-core-master\modules\swagger-annotations.

I can also see the models that map to those annotations in swagger-core-master\modules\swagger-core.

However, I don't see any entry point (like a main method I can invoke from command line). So, are there any sample java code that triggers the annotation processing and outputs the resulting swagger.json?

Another question:  I noticed the wiki from swagger-core references javadocs for annotations that are in the package "com.wordnik.swagger.annotations", while the code itself has the same annotations in package "io.swagger.annotations".  Is that just a pre-2.0 vs 2.0 version difference?

Thanks,
Arthur

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

--
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.
Reply all
Reply to author
Forward
0 new messages