0

I'm trying to specify file input in swagger.

ImportUser:

  properties:
    user_type_id:
      description: ID of the related user type
      type: integer
      format: int32
      example: '1'
      nullable: false
    csv_file:
      description: CSV file
      type: **file**
    skip_first_row:
      description: Identify whether first row should be skipped
      type: string
      format: unique
      maxLength: 100
      minLength: 1
      example: '1'
      nullable: false
  type: object

File upload button is shownin editor, but I'm getting following error:

Structural error at components.schemas.ImportOperatorDevice.properties.csv_file.type should be equal to one of the allowed values allowedValues: array, boolean, integer, number, object, string

pavlek86
  • 11
  • 1
  • 5
  • Do you use `swagger: '2.0'` or `openapi: 3.0.0`? How is the raw request supposed to look like - is it a POST request with `multipart/form-data` or something else? – Helen Apr 15 '19 at 09:24
  • It's openapi 3.0.0. And it's POST request with multipart/form-data. – pavlek86 Apr 15 '19 at 11:30
  • Tried that already, but when I specify it like type:string format:binary, error message is gone but then upload button is missing. – pavlek86 Apr 15 '19 at 13:59
  • Can you post your complete definition (with `type:string` + `format:binary`) and also add a screenshot of the missing upload button? – Helen Apr 15 '19 at 14:46
  • 1
    SOLVED :) It's OK with string + binary now, probably some browser caching thing. Thank you! – pavlek86 Apr 16 '19 at 07:13

0 Answers0