Skip to content

Allow file upload support using other mime types #326

@guw

Description

@guw

APIs allow for many different ways of uploading files. I'd like to be able to document the following in Swagger.

swagger: '2.0'

info:
  title: File Put Sample
  version: "1.0.0"
paths:
  /attachments/{name}:
    put:
      summary: Upload
      parameters:
        - name: name
          in: path
          description: the name of an attachment
          required: true
          type: string
        - name: content
          in: body
          description: the attachment content
          required: true
          schema:
            type: file
      consumes:
        - application/octet-stream
      responses:
        200:
          description: the upload was successful

This basically describes an API that can PUT file content onto a specific url. By setting consumes to other mime-typed then application/octet-stream (eg., image/png) it's also possible to express what content must be uploaded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions