我正在为我的Lambda创建API网关接口。我在下面的YAML部分。路径cse
已正确创建,但参数未正确创建。有任何想法吗?
CSEApiGateway:
Type: AWS::Serverless::Api
Properties:
Name: CSEApiGateway
StageName: Prod
Cors: "'*'"
DefinitionBody:
openapi: "3.0.1"
info:
description: 'API for Google CSE Lambda'
version: '1.0.0'
title: API for Google CSE Lambda
paths:
/cse:
get:
parameters:
qParam:
name: q
in: query
description: 'The query for CSE'
required: false
schema:
type: string
responses:
'200':
description: "OK"
headers:
Access-Control-Allow-Origin:
type: string
x-amazon-apigateway-integration:
uri:
Fn::Sub: 'arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${CSELambda.Arn}/invocations'
responses:
default:
statusCode: 200
responseTemplates:
- text/html: "$input.path('$')"
responseParameters:
method.response.header.Access-Control-Allow-Origin: "'*'"
requestParameters:
- integration.request.querystring.q: "method.request.querystring.q"
在控制台中查看创建的API的图像-“方法请求”部分和“集成请求”部分均缺少该参数。
API网关截图
任何想法表示赞赏。
我不是Yaml专家,但是您似乎将参数指定为地图而不是列表。
在此处查看示例:https : //github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml#L17
我认为您的Yaml应该更像:
parameters:
- name: q
in: query
description: 'The query for CSE'
required: false
schema:
type: string
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句