Skip to content

Wrong content type for sending multipart/form-data for version 3.3.2 #3781

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

Closed
haqqi opened this issue Oct 19, 2017 · 5 comments
Closed

Wrong content type for sending multipart/form-data for version 3.3.2 #3781

haqqi opened this issue Oct 19, 2017 · 5 comments

Comments

@haqqi
Copy link

haqqi commented Oct 19, 2017

There is similar issue, #3009, but that is for swagger ui 2.x. This is for 3.3.2.

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? 3.0.0
Which Swagger-UI version? 3.3.2
How did you install Swagger-UI? Using dist folder to my localhost
Which browser & version? Firefox and Chrome latest
Which operating system? Windows 10 Pro

I suppose my yaml file is correct. I don't include responses node, because the problem is not there.

  post:
    tags:
      - Authentication
    summary: Submit registration data of user to the server
    requestBody:
      description: User to add into the system.
      content:
        'multipart/form-data':
          schema:
            type: object
            properties:
              'User[name]':
                type: string
                example: Muhammad Fauzil Haqqi
              'User[phoneNumber]':
                type: string
                example: 08123123123
              'User[email]':
                type: string
                example: [email protected]
              'User[password]':
                type: string
                example: secretpassword

Using Swagger UI 3.3.2, if i try to send the request using Try it Out button. I log the server request, and read the headers. The content type is text/plain;charset=UTF-8, so my form-data cannot be read by my server side code.

Just a note, if i change the openapi version to 3 instead of 3.0.0, the request body and the response example is not rendered.

Another problem is, the React component show error Could not render this component, see the console.. Seems like the request text could not be rendered.

@webron
Copy link
Contributor

webron commented Oct 19, 2017

Support for 'form data' parameters in OAS3 is not fully implemented yet and that's covered in #3641.

openapi: 3 is not valid.

In order to check the last problem, we'd need the full spec and to know if there's a specific action that triggers or or is it right after load.

@haqqi
Copy link
Author

haqqi commented Oct 20, 2017

Noted for the form data parameter not yet supported.

For the last problem, i think it happens when i click "Execute" button. Seems like it is related with the support of form data. Because for application/json content type, it is no problem.

@sh0umik
Copy link

sh0umik commented Feb 4, 2018

The error still exists in both parameters and requestBody field

@hkosova
Copy link
Contributor

hkosova commented May 29, 2018

OAS3 multipart requests work now in Swagger UI 3.16.0.

OAS 3 multipart request in Swagger UI

@webron
Copy link
Contributor

webron commented Jul 5, 2018

Closing as fixed.

@webron webron closed this as completed Jul 5, 2018
@lock lock bot locked and limited conversation to collaborators Jul 5, 2019
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

4 participants