swagger.io icon indicating copy to clipboard operation
swagger.io copied to clipboard

missing file object in yaml spec for upload file specs

Open ahdbk opened this issue 1 year ago • 1 comments

In the upload file documentation there is a missing property for the multipart request example

image

      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                orderId:
                  type: integer
                userId:
                  type: integer
                fileName:
                  type: string
+              file:
+                type: string
+                format: binary

Link to the doc: https://swagger.io/docs/specification/describing-request-body/file-upload/

ahdbk avatar Apr 17 '23 11:04 ahdbk

Here is an excerpt from OpenAPI 3.0.3:

image

@frankkilcommins I think @ahdbk is right.

We either have to do this modification:

      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                orderId:
                  type: integer
                userId:
                  type: integer
                fileName:
                  type: string
                  format: binary

or

      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                orderId:
                  type: integer
                userId:
                  type: integer
                fileName:
                  type: string # this property only defines the name of the file, not it's content
                file:
                  type: string
                  format: binary

char0n avatar May 02 '23 07:05 char0n