I want to use swagger-codegen to generate REST clients and possibly static HTML documentation.
However, swagger-codegen needs swagger.json for input.
I am aware, that I can get this from a running REST server equipped with Swagger.
But is there a way to obtain swagger.json directly from my Java code - i.e. to generate it with gradle from the source code - without the need to run the application in a web container, and pointing curl
or a browser to it?
This is a bit old but I was wondering exactly the same... In short I've started the research with:
I managed to generate the JSON spec as a build artifact using two different approaches:
I've summarized my research in a simple project located here. See the Automation
section. Code and examples are included.