5

I am working on a project that requires to upload a file via flasgger UI. I modified my conf based on Swagger docs but doesn't seem to work. Below is my conf. Please, let know the mistake.

"""
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'
"""
  • Figured out. Had to add type parameter as well with "file" as value under parameters. – prakhar mishra Jul 08 '17 at 07:37
  • I tried using the type parameter but the file keeps loading when i upload it. Any idea what the issue would be? – AKSHAYAA VAIDYANATHAN Feb 05 '18 at 12:16
  • you can use this template "parameters": [ { "in": "formData", "name": "file", "description": "Accepts a valid .xls file", "required": True, "type": "file" }, { "in": "formData", "name": "created_by", "description": "Accepts a valid user name", "required": True, "type": "string" } ] – Akhil S Sep 06 '22 at 05:28

1 Answers1

7

You are missing 'type: file', the following worked for me:

...
parameters:
    - name: file
      required: false
      in: formData
      type: file
...
Emilia Apostolova
  • 1,719
  • 15
  • 18