为 REST API 生成 Swagger UI 文档 [英] Generating Swagger UI documentation for REST API

查看:39
本文介绍了为 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 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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