Flasgger - 上传文件

时间:2017-07-06 13:51:40

标签: python flask swagger flasgger

我正在开发一个需要通过flasgger UI上传文件的项目。我根据Swagger文档修改了我的conf但似乎没有用。以下是我的conf。请知道错误。

"""
This API let's you train word embeddings
Call this api passing your file and get the word embeddings.

---
tags:
  - Train (Word Embeddings)
consumes:
  - multipart/form-data  
parameters:
  - in: formData
    name: body
    required: true
    description: Upload your file.
responses:
  500:
    description: ERROR Failed!
  200:
    description: INFO Success!
    schema:
      $ref: '#/definitions/txt_embeddings'
"""

1 个答案:

答案 0 :(得分:2)

您缺少“类型:文件”,以下内容对我有用:

...
parameters:
    - name: file
      required: false
      in: formData
      type: file
...