Generating Swagger UI documentation for REST API(为 REST API 生成 Swagger UI 文档)
问题描述
我使用 Java 中的 JAX-RS/Jersey 开发了我的 REST API.我想为其转换/生成基于 Swagger 的 UI 文档.谁能以简单的方式告诉我如何做到这一点的精确/步骤?很抱歉,他们网站上给出的步骤对我来说有点模糊.
I have my REST API developed using JAX-RS/Jersey in Java. I want to convert to/generate Swagger based UI documentation for it. Can anyone please tell me precise/steps in simple way on how to do so? I m sorry but, steps given on their site are little vague for me.
推荐答案
有几种方法可以将 swagger-core 与您的应用程序集成,但根据您的描述,我将按照 https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-1.X-Project-Setup-1.5 或 https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5 取决于您使用的 Jersey 版本.
There are several ways to integrate swagger-core with your application, but based on your description, I'd just follow the wiki page as described either by https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-1.X-Project-Setup-1.5 or https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5 depending on the Jersey version you use.
这些页面还链接到一组示例,供您参考并了解它们的工作原理.他们还将 swagger-ui 直接拉入其中,因此您可以看到全套交互.
Those pages also link to a set of samples you can use for reference and see how they work. They also pull in swagger-ui directly into them so you can see a full set of interaction.
这篇关于为 REST API 生成 Swagger UI 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为 REST API 生成 Swagger UI 文档


基础教程推荐
- 大摇大摆的枚举 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 多个组件的复杂布局 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01