gpt4 book ai didi

api - YAML 语法错误 : Incomplete explicit mapping pair; a key node is missed at

转载 作者:行者123 更新时间:2023-12-04 14:31:39 25 4
gpt4 key购买 nike

我在 YAML 中编写 swagger 规范时遇到了模糊的错误。我已经映射了我认为正确的路径和定义,但不确定此错误的含义:

YAML Syntax Error Incomplete explicit mapping pair; a key node is missed at line 66, column 30: format: int64schema: ^t

线条:

 Line 65:         type: integer
Line 66: format: int64

Swagger :

  /product/{productId}:
get:
tags:
- content
summary: Find product item by ID
description: Returns a product item when ID < 10. ID > 10 or nonintegers will simulate API error conditions
operationId: getProductItemByID
produces:
- application/json
- application/xml
parameters:
- in: path
name: productId
description: ID of menu item that needs to be fetched
required: true
type: integer
format: int64
schema:
$ref: "#/definitions/Product"
responses:
"404":
description: Product item not found
"200":
description: successful operation
schema:
$ref: "#/definitions/Product"
"400":
description: Invalid ID supplied
security:
- api_key: []
- my_auth:
- write
- read

然后在 swagger 文件的底部定义:

definitions:

Product:
type: object
properties:
id:
type: integer
format: int64
category:
$ref: '#/definitions/Category'
name:
type: string
detail:
type: string

最佳答案

来自 swagger 2.0 spec ,如果“in”参数是“路径”,则不能使用模式。我认为这是一个错误,你应该使用:

/product/{productId}:
get:
tags:
- content
summary: Find product item by ID
description: Returns a product item when ID < 10. ID > 10 or nonintegers will simulate API error conditions
operationId: getProductItemByID
produces:
- application/json
- application/xml
parameters:
- in: path
name: productId
description: ID of menu item that needs to be fetched
required: true
type: integer
format: int64
responses:
"404":
description: Product item not found
"200":
description: successful operation
schema:
$ref: "#/definitions/Product"
"400":
description: Invalid ID supplied
...

关于api - YAML 语法错误 : Incomplete explicit mapping pair; a key node is missed at,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32638475/

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