Skip to content

Commit c2ec0ba

Browse files
authored
Pass ObjectMapper to JacksonConverterFactory (#17673)
This commit fixes an issue where the object mapper is not passed to the JacksonConverterFactory. The issue causing the serialization to fail when passing to the ApiClient a pre-configured mapper object (e.g. the primary bean of SpringBoot). With this fix, the bean would be correctly passed to the factory, and the serialization would work "out of the box" for the pre-configured bean.
1 parent 74a3a88 commit c2ec0ba

File tree

3 files changed

+3
-3
lines changed
  • modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure
  • samples/client/petstore
    • kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/infrastructure
    • kotlin-retrofit2-jackson/src/main/kotlin/org/openapitools/client/infrastructure

3 files changed

+3
-3
lines changed

modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-retrofit2/infrastructure/ApiClient.kt.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ import okhttp3.MediaType.Companion.toMediaType
9090
kotlinxSerializationJson.asConverterFactory("application/json".toMediaType()),
9191
{{/kotlinx_serialization}}
9292
{{#jackson}}
93-
JacksonConverterFactory.create(),
93+
JacksonConverterFactory.create(serializerBuilder),
9494
{{/jackson}}
9595
)
9696
) {

samples/client/petstore/kotlin-jvm-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ApiClient(
2828
),
2929
private val converterFactories: List<Converter.Factory> = listOf(
3030
ScalarsConverterFactory.create(),
31-
JacksonConverterFactory.create(),
31+
JacksonConverterFactory.create(serializerBuilder),
3232
)
3333
) {
3434
private val apiAuthorizations = mutableMapOf<String, Interceptor>()

samples/client/petstore/kotlin-retrofit2-jackson/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ApiClient(
2828
),
2929
private val converterFactories: List<Converter.Factory> = listOf(
3030
ScalarsConverterFactory.create(),
31-
JacksonConverterFactory.create(),
31+
JacksonConverterFactory.create(serializerBuilder),
3232
)
3333
) {
3434
private val apiAuthorizations = mutableMapOf<String, Interceptor>()

0 commit comments

Comments
 (0)