【若依(ruoyi)】swagger 生成接口文档
前言若依(ruoyi): v4.3若依自带了 swagger 的接口。将若依启动后,访问 http://localhost/swagger-ui.html (或者使用菜单系统工具 -> 系统接口)可以查看接口。将若依启动后,访问 http://localhost/v2/api-docs 可以查看 json 格式的接口文档。一切都很不错,只是要有个 html 或 pdf 格式的接口文档就更好了
前言
- 若依(ruoyi): v4.3
若依自带了 swagger 的接口。
将若依启动后,访问 http://localhost/swagger-ui.html
(或者使用菜单系统工具 -> 系统接口
)可以查看接口。
将若依启动后,访问 http://localhost/v2/api-docs
可以查看 json 格式的接口文档。
一切都很不错,只是要有个 html 或 pdf 格式的接口文档就更好了。
更好的 html 或 pdf 格式的接口文档
要生成更好的 html 或 pdf 格式的接口文档需要用到 swagger2pdf
项目。
生成的步骤是这样的:
- 将
http://localhost/v2/api-docs
的json格式接口文档,利用Swagger2Markup
Maven插件生成asciidoc
格式的文档。 - 利用
asciidoctor
Maven插件生成 html 和 pdf 文件。
操作
- 克隆项目 https://gitee.com/sayyy/swagger2pdf
- 将
http://localhost/v2/api-docs
另存为swagger.json
- 替换
swagger2pdf/src/test/resources
目录下的swagger.json
- 在
swagger2pdf
目录下执行命令:mvn clean test
- 在
swagger2pdf/target/asciidoc
目录找到 html/pdf 格式的接口文档
结果展示
参考
https://github.com/Swagger2Markup/spring-swagger2markup-demo
https://leongfeng.github.io/2017/02/20/springboot-springfox-swagger2markup-spring-restdoc/
https://gitee.com/nitianziluli/swagger2pdf
https://github.com/nitianziluli/swagger2pdf
https://blog.csdn.net/u013719669/article/details/80998225
更多推荐
所有评论(0)