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
parent 0034ddfe0a
commit bccf947508
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 {