gpt4 book ai didi

amazon-web-services - serverless-aws-documentation 模板的资源 block 中 Unresolved 资源依赖关系

转载 作者:行者123 更新时间:2023-12-03 07:15:39 24 4
gpt4 key购买 nike

我正在为我的服务制作文档。我已经做了很少的事情,但我被这个问题困住了。这很奇怪,因为这对于以前的工作正常,而且也是根据 Serverless AWS Documentation

我的 serverless.yml 中有这些模型:

- name: "Player"
description: "Golf Player"
contentType: "application/json"
schema:
type: object
properties:
FirstName:
type: string
description: "Player First Name"
LastName:
type: string
description: "Player Last Name"
- name: "Booking"
contentType: "application/json"
schema:
type: object
properties:
_id:
type: string
description: "Booking ObjectId"
slotId:
type: string
description: "timeslot ID"
startTime:
type: string
description: "Booking Start Time"
endTime:
type: string
description: "Booking End Time"
accountId:
type: string
description: "Booker Account ID"
Players:
type: array
items:
$ref: "{{model: Player}}"
- name: "ErrorResponse"
contentType: "application/json"
schema:
type: object
properties:
message:
type: string
statusCode:
type: number

我的函数中出现错误:

functions:


getBooking:
timeout: 300
handler: handlers/booking/getBooking.handler
events:
- http:
path: /booking/{id}
method: get
cors: true
request:
parameters:
paths:
id: true
documentation:
summary: "GetBooking"
description: "Gets Booking by bookingNumber"
tags:
- "Bookings"
pathParams:
- name: "id"
description: "bookingNumber"
required: true
methodResponses:
- statusCode: "200"
responseBody:
description: "Response with Booking object"
responseHeaders:
- name: "Access-Control-Allow-Origin"
- name: "Access-Control-Allow-Credentials"
responseModels:
"application/json": "Booking"
- statusCode: "400"
responseModels:
"application/json": "ErrorResponse"
- statusCode: "500"
responseModels:
"application/json": "ErrorResponse"

我尝试更改模型,不使用引号等,但在部署时仍然遇到此错误:

  • 错误:CloudFormation 模板无效:模板格式错误:模板的资源 block 中未解析的资源依赖项 [ErrorResponseModel]

如果有人能提供帮助,那就太好了。谢谢

最佳答案

要获得成功的结果,您需要做两件事:

  1. 删除 requestModelsresponseModels 值中的引号。

    ...
    responseModels:
    "application/json": Booking
    - statusCode: "400"
    responseModels:
    "application/json": ErrorResponse
    - statusCode: "500"
    responseModels:
    "application/json": ErrorResponse
  2. 缩进成功 (200) 个响应键(statusCoderesponseBodyresponseHeadersresponseModels )在同一行:

    ...
    - statusCode: "200"
    responseBody:
    description: "Response with Booking object"
    responseHeaders:
    - name: "Access-Control-Allow-Origin"
    - name: "Access-Control-Allow-Credentials"
    responseModels:
    "application/json": Booking
    ...

关于amazon-web-services - serverless-aws-documentation 模板的资源 block 中 Unresolved 资源依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59107851/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com