Bug Report Checklist
Description
Setting:
openapi generator with maven, generate client with generator kotlin, and the okhttp4 and jackson libraries
When useing the generator the generate a kotlin client for a multipart/form-data request that has a part json and a part file,
the generated code doesn't serialize the object to json.
That part has no Content-Type definition and the body is the toString() output of the object
Here a spring boot project to reproduce the issue: https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/tree/main
It contains, generator configs, spec and a test to showcase the issue.
payload of the generated client:
Content-Disposition: form-data; name="metadata"
Content-Length: 39
Metadata([email protected], locale=en)
--4975a2aa-2415-4a44-9231-a6c74e59088a
Content-Disposition: form-data; name="report"; filename="report-5cc1c8cf-9780-4268-b0dd-cc57c1b7a45c270820599018655007.xml"
Content-Type: application/xml
Content-Length: 83
<?xml version="1.0" encoding="UTF-8" ?>
<body>
<value>Some Text</value>
</body>
--4975a2aa-2415-4a44-9231-a6c74e59088a--
expected payload:
Content-Disposition: form-data; name="metadata"
Content-Type: application/json
{ "email": "[email protected]" "locale": "en" }
--4975a2aa-2415-4a44-9231-a6c74e59088a
Content-Disposition: form-data; name="report"; filename="report-5cc1c8cf-9780-4268-b0dd-cc57c1b7a45c270820599018655007.xml"
Content-Type: application/xml
Content-Length: 83
<?xml version="1.0" encoding="UTF-8" ?>
<body>
<value>Some Text</value>
</body>
--4975a2aa-2415-4a44-9231-a6c74e59088a--
openapi-generator version
On our project we currently use 6.4.0 but also the later versions have the issue.
Checked the following versions:
OpenAPI declaration file content or url
https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/blob/main/src/main/resources/spec-for-client-generation.yaml
Generation Details
generator: kotlin
library: jvm-okhttp4
serializationLibrary: jackson
For more details see the config in the reprducer project.
mvn plugin config: https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/blob/main/pom.xml#L63-L94
Steps to reproduce
checkout the project: https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/tree/main
run ./mvnw test, there is a test that prints the request to console for inspection
or at least ./mvnw compile to generate the client code
Related issues/PRs
Suggest a fix
Bug Report Checklist
Description
Setting:
openapi generator with maven, generate client with generator
kotlin, and theokhttp4andjacksonlibrariesWhen useing the generator the generate a kotlin client for a
multipart/form-datarequest that has a part json and a part file,the generated code doesn't serialize the object to json.
That part has no
Content-Typedefinition and the body is thetoString()output of the objectHere a spring boot project to reproduce the issue: https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/tree/main
It contains, generator configs, spec and a test to showcase the issue.
payload of the generated client:
expected payload:
openapi-generator version
On our project we currently use
6.4.0but also the later versions have the issue.Checked the following versions:
OpenAPI declaration file content or url
https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/blob/main/src/main/resources/spec-for-client-generation.yaml
Generation Details
generator:
kotlinlibrary:
jvm-okhttp4serializationLibrary:
jacksonFor more details see the config in the reprducer project.
mvn plugin config: https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/blob/main/pom.xml#L63-L94
Steps to reproduce
checkout the project: https://github.com/Fynnyan/kotlin-okhhtp-open-api-bug/tree/main
run
./mvnw test, there is a test that prints the request to console for inspectionor at least
./mvnw compileto generate the client codeRelated issues/PRs
Suggest a fix