如何生成离线Swagger API文档? [英] How to generate offline Swagger API docs?

查看:2071
本文介绍了如何生成离线Swagger API文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Spring Boot MVC java Web应用程序。我已经能够集成Springfox for API文档。当服务器启动并运行时,我可以直观地看到所有API。

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.

如何生成OFFLINE swagger API文档?注意:我不想使用asciidoc或markdown文档,但我想在html文件中使用相同的swagger API用户界面。我想这样链接是相对于本地目录而不是本地主机服务器链接。谢谢

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

推荐答案

Springfox允许您根据Spring注释轻松创建Swagger测试器/ API文档。

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

Swagger本身有一些工具可以让你生成离线/静态文档:

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

它们都需要Swagger YAML或JSON文件。如果您在使用Spring Fox时没有使用YAML / JSON中的Swagger定义,则可以使用生成的文件用于Swagger UI( / v2 / api-docs?group =< group名称> )。

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

这篇关于如何生成离线Swagger API文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆