我在YAML中写了一些swagger规范并且出现了模糊的错误。我已经正确地映射了我的路径和定义,并且不确定这个错误意味着什么:
YAML语法错误不完整的显式映射对;关键节点是 错过第66行,第30列:格式:int64schema:^ t
行:
Line 65: type: integer
Line 66: format: int64
扬鞭:
/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
答案 0 :(得分:2)
来自swagger 2.0 spec,如果&#39;在&#39;参数是&#34;路径&#34;你不能使用架构。 我认为有一个错误你应该使用:
/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
...