amazon-web-services - API 网关与 Lambda 代理集成的 API 文档
问题描述
我定义了一个 SAM 应用程序,在 API 网关后面只有几个 Lambda”
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: !Ref EnvType
Auth:
DefaultAuthorizer: LambdaTokenAuthorizer
Authorizers:
LambdaTokenAuthorizer:
FunctionArn: !GetAtt AuthorizerLambda.Arn
MyFunction:
Type: 'AWS::Serverless::Function'
...
Events:
MyEvent:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: "/MyResource/{proxy+}"
Method: post
显然,API Gateway 对代理资源了解不多,例如:
- 代理路径
- 请求模型
- 响应模型
从 API Gateway 阶段生成的文档反映了这一点:
swagger: "2.0"
info:
version: "1.0"
title: "xxx-dev"
host: "xxx.execute-api.us-west-2.amazonaws.com"
basePath: "/dev"
schemes:
- "https"
paths:
/MyResource/{proxy+}:
post:
responses: {}
security:
- LambdaTokenAuthorizer: []
securityDefinitions:
LambdaTokenAuthorizer:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "custom"
有没有办法为 API Gateway 提供缺失的位(代理路径、响应模型、请求模型)?最终我需要一个足够好的文档来生成客户端代码/允许一些集成测试。类似的问题在这里-> Aws lambda proxy Swagger template integration
解决方案
推荐阅读
- ruby-on-rails - 如何在 Rails 4 中删除 has_one 关联?
- javascript - 如何使用 create-react-app 设置 Jest Watch 插件
- sorting - 如何使用柏树找到哪个变量更大
- azure - 无法在 Swagger 中进行身份验证
- html - 用于在大量链接列表中填充标签的“标题”属性的复杂(?)正则表达式
- angular - 我们可以将两个布尔变量中的任何一个传递给子组件像这样
- jquery - Jquery - 查找/每个触发两次
- python - 如何使用python每5分钟下载和保存交换数据
- python - Mechanize 在所需网站中未找到任何表格
- sabre - Sabre CreatePassengerNameRecord - 使用 3 条目输入事实,TTY 请求挂起