Skip to content

Commit

Permalink
Pass ObjectMapper to JacksonConverterFactory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yonatankarp committed Jan 22, 2024
1 parent 189bf7d commit f16104e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import okhttp3.MediaType.Companion.toMediaType
kotlinxSerializationJson.asConverterFactory("application/json".toMediaType()),
{{/kotlinx_serialization}}
{{#jackson}}
JacksonConverterFactory.create(),
JacksonConverterFactory.create(serializerBuilder),
{{/jackson}}
)
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ApiClient(
),
private val converterFactories: List<Converter.Factory> = listOf(
ScalarsConverterFactory.create(),
JacksonConverterFactory.create(),
JacksonConverterFactory.create(serializerBuilder),
)
) {
private val apiAuthorizations = mutableMapOf<String, Interceptor>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ApiClient(
),
private val converterFactories: List<Converter.Factory> = listOf(
ScalarsConverterFactory.create(),
JacksonConverterFactory.create(),
JacksonConverterFactory.create(serializerBuilder),
)
) {
private val apiAuthorizations = mutableMapOf<String, Interceptor>()
Expand Down

0 comments on commit f16104e

Please sign in to comment.