Skip to content

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

@haqqi

Description

@haqqi

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions