swagger-editor
swagger-editor copied to clipboard
Cant make a "multipart/form-data" request with kotlin-client generated code
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:
- Go to 'https://editor.swagger.io/'
- Click on 'Generate Client'
- Click on 'kotlin'
- Open the downloaded folder 'kotlin-client'
- Make a multipart-data request
- See error
Expected behavior
Make a "multipart/form-data" request