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.
This commit is contained in:
Yonatan Karp-Rudin 2024-01-22 18:09:45 +01:00 committed by GitHub
parent 74a3a8870d
commit c2ec0bafdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ import okhttp3.MediaType.Companion.toMediaType
kotlinxSerializationJson.asConverterFactory("application/json".toMediaType()),
{{/kotlinx_serialization}}
{{#jackson}}
JacksonConverterFactory.create(),
JacksonConverterFactory.create(serializerBuilder),
{{/jackson}}
)
) {

View File

@ -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>()

View File

@ -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>()