问题描述
大家好,我在使用 YAML 时遇到了困难,我需要你们的帮助.我有这个代码,它给了我错误,我找不到我做错的地方或什么.我收到的错误消息在下面
/product/{productid}/fabric/{fabricid}:得到:标签:- 产品"摘要:通过 ID 获取 Fabric"描述:此端点显示结构详细信息"产生:- 应用程序/json"参数:- 名称:织物"在:路径"描述:这是织物的唯一标识符"要求:真实类型:字符串"回应:200:描述:成功操作"架构:类型:数组"项目:$ref: "#/定义/织物"400:描述:无效的状态值"删除:标签:- 产品"摘要:按 ID 删除结构"描述:按 id 删除 Fabric"操作 ID:删除织物"产生:- 应用程序/json"参数:- 名称:织物"在:路径"描述:需要删除的Fabric ID"要求:真实类型:整数"最低:1.0格式:int64"回应:200:描述:成功操作"架构:类型:数组"项目:$ref: "#/定义/织物"400:描述:提供的 ID 无效"404:描述:未找到面料"
我收到的错误消息.:
错误信息一目了然.您定义了一个带有 2 个路径参数的路径:
/product/{productid}/fabric/{fabricid}:
但是您没有在 parameters
部分定义 productid
参数.
查看路径和操作和描述参数 以了解有关路径和参数的 OpenAPI 语法的更多信息.>
Hi guys I am having difficulties with YAML and I need your help.I am having this code and it gives me error, and i cant find where or what i am doing wrong.Error msg that i am receiving is below
/product/{productid}/fabric/{fabricid}:
get:
tags:
- "Product"
summary: "Get Fabric by Id"
description: "This endpoint displays Fabric details"
produces:
- "application/json"
parameters:
- name: "fabricid"
in: "path"
description: "This is unique identifier of the fabric"
required: true
type: "string"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/fabric"
400:
description: "Invalid status value"
delete:
tags:
- "Product"
summary: "Delete Fabric by Id"
description: "Delete Fabric by id"
operationId: "deleteFabric"
produces:
- "application/json"
parameters:
- name: "fabricid"
in: "path"
description: "ID of the Fabric that needs to be deleted"
required: true
type: "integer"
minimum: 1.0
format: "int64"
responses:
200:
description: "successful operation"
schema:
type: "array"
items:
$ref: "#/definitions/fabric"
400:
description: "Invalid ID supplied"
404:
description: "Fabric not found"
Error msg that i am receiving. :
The error message is rather self-explanatory. You defined a path with 2 path parameters:
/product/{productid}/fabric/{fabricid}:
but you did not define the productid
parameter in the parameters
section.
Check out Paths and Operations and Describing Parameters to learn more about OpenAPI syntax for paths and parameters.
这篇关于我的产品中的 Swagger-YAML 错误映射条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!