如何使用Swagger UI访问AWS API Gateway文档 [英] How to access AWS API Gateway documentation using Swagger UI

查看:269
本文介绍了如何使用Swagger UI访问AWS API Gateway文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用AWS Api网关创建了API.然后,我为所有实体(如API,资源,方法,模型等)记录了文档部分.然后,我使用AWS Gateway Console将文档发布到版本1

I have created API using AWS Api Gateway. Then i have documented documentation parts for all the entities ( like API, RESOURCE, METHOD, MODEL etc). Then using AWS Gateway Console i have published the documentation to dev stage with version 1

但是我不确定我(或API的使用者)将如何访问文档?

But i am not sure how do i (or the consumer of the API) going to access the documentation?

有一个Export选项,可以将文档导出为SwaggerOpenAPI3.这将创建.json.yaml文件,然后使用者必须将这些文件导入到swagger UI中.但是,这不是一种用户友好的选项,每次我向所有使用者更新文档时都提供不完整的文件.

There is an Export option that can export documentation as Swagger or OpenAPI3. This will create .json or .yaml file and then consumer has to import these files into swagger UI. However this is not user-friendly option to provide swagger file every time i update documentation to all consumers.

我想知道,在发布文档之后,无论如何,消费者都可以直接通过http访问文档.因此,假设我的dev阶段api URL是 https://devapi.example.com/v1,因此类似https://devapi.example.com/v1/help的东西应该使用最新发布的swagger文件启动Swagger UI.

I was wondering, after publishing the documentation is there anyway consumer can access documentation directly via http. So lets assume my dev stage api URL is https://devapi.example.com/v1 so something like https://devapi.example.com/v1/help should launch Swagger UI with latest published swagger file.

更新1
在ASP.NET Web API或.NET Core中,您可以包括Swashbuckle,它可以创建swagger文件,并且还具有Swagger UI工具的嵌入式版本.因此,在部署API之后,用户可以直接从用户界面访问文档,例如https://devapi.example.com/swagger.
我希望AWS网关也能提供同样的服务.发布文档后,应通过一些预定义的资源路径使该文档可用.

Update 1
In ASP.NET Web API or .NET Core you can include Swashbuckle that creates swagger files and also has embedded version of the Swagger UI tool. So after deploying API user can access documentation directly from UI something like https://devapi.example.com/swagger.
I was hoping the same thing from AWS gateway. After publishing the documentation it should make that documentation available via some predefined resource path.

推荐答案

AWS API网关只能使文档可导出,而不能呈现UI应用程序.没有可以在网关中用于呈现文档的终结点.您可能希望使用第三方工具或 AWS API网关开发人员门户允许用户浏览API文档.您可能会发现此博客有帮助的.

AWS API Gateway can only make documentation exportable but won't render a UI app. There is no endpoint that you can use in the gateway to render the documentation. You may wish to use third party tools or AWS API Gateway Developer Portal to allow users browse API documentation. You may find this blog helpful.

这篇关于如何使用Swagger UI访问AWS API Gateway文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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