From 418fa463462cdc88c6b7c7331cdc1d250067ee4c Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 30 Sep 2022 20:17:22 +0100 Subject: [PATCH] ignoring nulls unless explicitly declared in the api models, passing null breaks some endpoints --- .../kotlin/app/dapk/st/matrix/http/MatrixHttpClient.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/matrix/matrix-http/src/main/kotlin/app/dapk/st/matrix/http/MatrixHttpClient.kt b/matrix/matrix-http/src/main/kotlin/app/dapk/st/matrix/http/MatrixHttpClient.kt index 85e5e7d..6cf64a5 100644 --- a/matrix/matrix-http/src/main/kotlin/app/dapk/st/matrix/http/MatrixHttpClient.kt +++ b/matrix/matrix-http/src/main/kotlin/app/dapk/st/matrix/http/MatrixHttpClient.kt @@ -3,6 +3,7 @@ package app.dapk.st.matrix.http import io.ktor.client.utils.* import io.ktor.http.content.* import io.ktor.util.reflect.* +import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json interface MatrixHttpClient { @@ -47,7 +48,11 @@ interface MatrixHttpClient { companion object { val json = Json - val jsonWithDefaults = Json { encodeDefaults = true } + @OptIn(ExperimentalSerializationApi::class) + val jsonWithDefaults = Json { + encodeDefaults = true + explicitNulls = false + } } fun interface Factory {