Swagger-YAML Bad Mapping entry in my products [duplicate]

邮差的信 提交于 2019-12-11 17:16:22

问题


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. :


回答1:


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.



来源:https://stackoverflow.com/questions/51487027/swagger-yaml-bad-mapping-entry-in-my-products

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!