YAML错误映射条目

YAML错误映射条目

本文介绍了我的产品中的Swagger-YAML错误映射条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在使用YAML时遇到困难,需要您的帮助.我有这段代码,它给了我错误,并且我找不到我在哪里或做错了.我收到的错误消息在下面

 /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"

我收到的错误消息. :

解决方案

错误消息是不言自明的.您定义了一个具有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错误映射条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 11:38