How to generate offline Swagger API docs?(如何生成离线 Swagger API 文档?)
问题描述
我有一个 Spring Boot MVC Java Web 应用程序.我已经能够为 API 文档集成 Springfox.当服务器启动并运行时,我可以直观地看到所有 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:
- Swagger 编辑器有多种生成文档的方法,列在生成客户端 菜单
- Swagger Codegen 模块允许您生成静态和动态 HTML 文档
- 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 文件.如果您因为使用 Springfox 而在 YAML/JSON 中没有 Swagger 定义,则可以使用生成的用于 Swagger UI 的文件 (/v2/api-docs?group=<group name>).
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 文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何生成离线 Swagger API 文档?
基础教程推荐
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- 将 double 转换为 Int,向下舍入 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- JPA惰性列表上的流 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
