我的产品中的Swagger-YAML错误映射条目

时间:2018-07-23 20:49:10

标签: api yaml swagger

大家好,我在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" 

我收到的错误消息。 :enter image description here

1 个答案:

答案 0 :(得分:2)

错误消息是不言自明的。您使用2个路径参数定义了路径:

/product/{productid}/fabric/{fabricid}:

但是您没有在productid部分中定义parameters参数。

查看Paths and OperationsDescribing Parameters,以了解有关路径和参数的OpenAPI语法的更多信息。