put请求

时间:2017-03-11 12:52:48

标签: swagger swagger-2.0

在下面的招摇文档中,我得到了一个参数定义错误。

  /store/{Filepath}:
    put:
      summary: Store file to the archive
      description: ""
      consumes:
        - multipart/form-data
      produces:
        - application/json
      parameters:
        - in: path
          name: Filepath
          type: string
          description: Filename
          required: true
        - in: body
          name: body
          description: File to be uploaded
          required: true
          type: file
      responses:
        "201":
          description: File sucessfully stored

这会在Not a valid parameter definition上方的行上生成- in: body错误和点。我看不出有什么问题,你们发现可能出错的地方。

1 个答案:

答案 0 :(得分:0)

您打算定义formData参数吗?例如:

    - in: formData
      name: body
      description: File to be uploaded
      required: true
      type: file

这应该消除错误,但我不确定它是你的意图。

如果您确实打算定义body参数,则需要schema属性:

    - in: body
      name: body
      description: File to be uploaded
      required: true
      schema:
        type: object