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

Cant make a "multipart/form-data" request with kotlin-client generated code #4609

Open
NunoAntunes5 opened this issue Nov 21, 2023 · 0 comments

Comments

@NunoAntunes5
Copy link

Q&A

  • OS: macOS
  • Browser: [e.g. chrome, safari]
  • Version: [e.g. 22]
  • Method of installation: [e.g. npm, dist assets]
  • Swagger-Editor version: [e.g. 3.10.0]
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]

Content & configuration

Generate kolin client from online swagger editor

Example Swagger/OpenAPI definition:

  /upload/{id}:
    post:
      description: Send multipart request
      tags:
        - Upload
      consumes:
        - multipart/form-data
      produces:
        - text/plain
        - application/json
        - text/json
      parameters:
        - in: path
          name: id
          required: true
          type: string
        - in: formData
          name: file
          type: file
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/ResponseUpload'

Swagger-Editor configuration options:
Using the online demo at editor.swagger.io

Describe the bug you're encountering

When I try to make the request after having generated the client through https://editor.swagger.io/, I get the following response "requires explicit JsonAdapter to be registered", this happens because at the start of the request the Content-Type is set to "multipart/form-data" but then in the ApiClient class in the request function it is set to "application-json" causing the multipart/from-data request not to happen giving a client error.

To reproduce...

Steps to reproduce the behavior:

  1. Go to 'https://editor.swagger.io/'
  2. Click on 'Generate Client'
  3. Click on 'kotlin'
  4. Open the downloaded folder 'kotlin-client'
  5. Make a multipart-data request
  6. See error

Expected behavior

Make a "multipart/form-data" request

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

No branches or pull requests

1 participant