路径语义错误./findfood/{foodItemId} 在 Swagger 编辑器中
Semantic error at paths./findfood/{foodItemId} in Swagger Editor
我是 Swagger 的新手。我使用 Swagger Editor 编写了以下代码,但遇到了多个错误。我已经查看了文档和其他示例,但无法阐明问题。
swagger: '2.0'
info:
version: "1"
title: 'Grocery Shop'
description: 'This contains the url to access all the Grocery food related information. You can also add, update or delete any food item as well based on their respective id.'
contact:
email: you@your-company.com
tags:
- name: FoodItem
description: Specifically for Food item
- name: Category
description: Specifically for the category purpose
schemes:
- https
paths:
'/findfood/{foodItemId}':
get:
tags:
- FoodItem
summary: "Find the required food"
description: "Find the food with passed food id as an argument. Make sure that passed id exist otherwise it will return an error"
operationId: findFoodWithId
produces:
- "application/json"
parameters:
- in: path
name: foodItemId
required: true
type: integer
miniumum: 1
description: The id associated with the food in the grocery shop
responses:
200:
description: "successful operation"
schema:
$ref: '#definitions/Food'
404:
description: "Food is not found
definitions:
Food:
type: "object"
properties:
foodItemId:
type: integer
format: int32
required:
- foodItemId
xml:
name: "User"
# Added by API Auto Mocking Plugin
host: "localhost:8080"
basePath: "/grocery"
我遇到的错误是:
Semantic error at paths./findfood/{foodItemId} Declared path parameter
"foodItemId" needs to be defined as a path parameter at either the
path or operation level Jump to line 18
Schema error at paths./findfood/{foodItemId}.get.parameters[0] is not
exactly one from
<#/definitions/parameter>,<#/definitions/jsonReference> Jump to line
28
Parser error can not read a block mapping entry; a multiline key may
not be an implicit key Jump to line 48
这些错误具有误导性。实际错误是:
miniumum: 1
包含错字 - miniumum
$ref: '#definitions/Food'
需要 #
和 definitions
之间的 /
:'#/definitions/Food'
description: "Food is not found
需要结束引号。
我是 Swagger 的新手。我使用 Swagger Editor 编写了以下代码,但遇到了多个错误。我已经查看了文档和其他示例,但无法阐明问题。
swagger: '2.0'
info:
version: "1"
title: 'Grocery Shop'
description: 'This contains the url to access all the Grocery food related information. You can also add, update or delete any food item as well based on their respective id.'
contact:
email: you@your-company.com
tags:
- name: FoodItem
description: Specifically for Food item
- name: Category
description: Specifically for the category purpose
schemes:
- https
paths:
'/findfood/{foodItemId}':
get:
tags:
- FoodItem
summary: "Find the required food"
description: "Find the food with passed food id as an argument. Make sure that passed id exist otherwise it will return an error"
operationId: findFoodWithId
produces:
- "application/json"
parameters:
- in: path
name: foodItemId
required: true
type: integer
miniumum: 1
description: The id associated with the food in the grocery shop
responses:
200:
description: "successful operation"
schema:
$ref: '#definitions/Food'
404:
description: "Food is not found
definitions:
Food:
type: "object"
properties:
foodItemId:
type: integer
format: int32
required:
- foodItemId
xml:
name: "User"
# Added by API Auto Mocking Plugin
host: "localhost:8080"
basePath: "/grocery"
我遇到的错误是:
Semantic error at paths./findfood/{foodItemId} Declared path parameter "foodItemId" needs to be defined as a path parameter at either the path or operation level Jump to line 18
Schema error at paths./findfood/{foodItemId}.get.parameters[0] is not exactly one from <#/definitions/parameter>,<#/definitions/jsonReference> Jump to line 28
Parser error can not read a block mapping entry; a multiline key may not be an implicit key Jump to line 48
这些错误具有误导性。实际错误是:
miniumum: 1
包含错字 - miniumum$ref: '#definitions/Food'
需要#
和definitions
之间的/
:'#/definitions/Food'
description: "Food is not found
需要结束引号。