ignoring nulls unless explicitly declared in the api models, passing null breaks some endpoints

This commit is contained in:
Adam Brown 2022-09-30 20:17:22 +01:00 committed by Adam Brown
parent 2486a1eef6
commit 418fa46346
1 changed files with 6 additions and 1 deletions

View File

@ -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 {