Swagger-ui: Missing file browser in "Try it out" for multipart/form file uploads

Created on 19 Oct 2017  Â·  9Comments  Â·  Source: swagger-api/swagger-ui

Previously (in OpenAPI 2.0), when creating an endpoint which takes a file upload via a multipart/form POST request, the Try it out section in Swagger UI showed a Choose File button to select a file from my harddisk which then got uploaded when clicking the execute button.

Following the docs on how to do such uploads in OpenAPI 3.0.0, however, I am missing that button in Swagger UI and see a textbox instead with a JSON representation of the schema.

Is that expected behaviour (as in not yet implemented for OpenAPI 3.0.0) or is the file upload in my API definition incorrectly written?

| Q | A
| ------------------------------- | -------
| Bug or feature request? | Could be both, depending on if this is expected behaviour
| Which Swagger/OpenAPI version? | OpenAPI 3.0.0
| Which Swagger-UI version? | 3.3.2
| How did you install Swagger-UI? | https://editor.swagger.io and self-hosted dist folder on nginx
| Which browser & version? | Chrome 62.0 & Opera 48.0
| Which operating system? | Ubuntu 14.04

Demonstration API definition

Working example in OpenAPI 2.0:

swagger: '2.0'
info:
  title: Some API
  version: '1'
paths:
  /conversion/nmea/geojson:
    post:
      consumes:
        - multipart/form-data
      parameters:
        - in: formData
          name: file
          type: file
      produces:
        - text/plain
      responses:
        '200':
          description: OK
          schema:
            type: string
            example: "File upload successful"

Non-working example in OpenAPI 3.0.0:

openapi: 3.0.0
info:
  title: Some API
  version: "1"

paths:
  /upload:
    post:
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                type: string
                example: "File upload successful"

Expected Behavior

openapi_2 0

Current Behavior

openapi_3 0 0

lock-bot

Most helpful comment

I can say that the update worked for me

On Thu, Jul 12, 2018, 8:43 AM Ron notifications@github.com wrote:

@here https://github.com/here - this has been implemented and is
supposed to work (just tested it myself). If you encounter an issue, please
file a new ticket with steps and details to help us investigate.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/swagger-api/swagger-ui/issues/3784#issuecomment-404557161,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIgzVrZHv4eu_5WtTe4fBU6bPh6lV6mks5uF26IgaJpZM4P_DSW
.

All 9 comments

Closing in favor of #3641.

I meet the same issue, how to fix it?

I'm afraid I have hit the same road bump. Add one more user to the "futures" bucket tally for this issue.

@webron can this be reopened? Still not seeing and not easy to track in the other list

Same issue

Same issue

Same issue

@here - this has been implemented and is supposed to work (just tested it myself). If you encounter an issue, please file a new ticket with steps and details to help us investigate.

I can say that the update worked for me

On Thu, Jul 12, 2018, 8:43 AM Ron notifications@github.com wrote:

@here https://github.com/here - this has been implemented and is
supposed to work (just tested it myself). If you encounter an issue, please
file a new ticket with steps and details to help us investigate.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/swagger-api/swagger-ui/issues/3784#issuecomment-404557161,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIgzVrZHv4eu_5WtTe4fBU6bPh6lV6mks5uF26IgaJpZM4P_DSW
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Deraen picture Deraen  Â·  4Comments

easyest picture easyest  Â·  3Comments

nulltoken picture nulltoken  Â·  3Comments

ankon picture ankon  Â·  4Comments

DavidBiesack picture DavidBiesack  Â·  4Comments