Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing file browser in "Try it out" for multipart/form file uploads #3784

Closed
dirkschneemann opened this issue Oct 19, 2017 · 9 comments
Closed

Comments

@dirkschneemann
Copy link

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

@webron
Copy link
Contributor

webron commented Oct 19, 2017

Closing in favor of #3641.

@webron webron closed this as completed Oct 19, 2017
@jascao
Copy link

jascao commented Jan 10, 2018

I meet the same issue, how to fix it?

@mikefidel
Copy link
Contributor

mikefidel commented Feb 3, 2018

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

@jonbcampos
Copy link

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

@evgenymarkov
Copy link

Same issue

2 similar comments
@luiz-gustavo-agostinho
Copy link

Same issue

@tmaus
Copy link

tmaus commented Jul 12, 2018

Same issue

@webron
Copy link
Contributor

webron commented Jul 12, 2018

@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.

@jonbcampos
Copy link

jonbcampos commented Jul 12, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants