Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate offline Swagger API docs?

I have a spring boot MVC java Web app. I've been able to integrate Springfox for API documentation. I can visually see all of the APIs when server is up and running.

How can I generate OFFLINE swagger API documentation? Note: I would not like to use asciidoc or markdown documentation, but I'd like the same swagger API user interface in html files. I'd like so that the links are relative to local directory instead of local host server links. Thanks

like image 799
code Avatar asked Jan 25 '16 03:01

code


2 Answers

Springfox allows you to easily create a Swagger tester/API docs based on your Spring annotations.

Swagger itself has some tools to allow you to generate offline/static documentation:

  • The Swagger Editor has several ways of generating documentation listed in the Generate Client menu
  • The Swagger Codegen module allows you to generate a static and dynamic HTML document

Both of them require a Swagger YAML or JSON file. In case you don't have a Swagger definition in YAML/JSON because you're using Springfox, you can use the generated file used for Swagger UI (/v2/api-docs?group=<group name>).

like image 124
g00glen00b Avatar answered Sep 19 '22 18:09

g00glen00b


Swagger has tool for generating offline docs.

The tool is "Swagger2Markup" which is located @ Github.

The output of "Swagger2Markup" can be used as an alternative to swagger-ui and can be served as static content.

Here is an Example

Good luck! :)

like image 25
Sahar Menashe Avatar answered Sep 19 '22 18:09

Sahar Menashe