From 7e3e5e56e6888d854fed1f0cd42aaafcd137f83b Mon Sep 17 00:00:00 2001 From: Maksim Ignatev Date: Fri, 6 Jan 2023 15:37:05 +0400 Subject: [PATCH] Remove redundant .toString() call, use treeToValue instead of readValue --- .../kotlin/com/apurebase/kgraphql/request/VariablesJson.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kgraphql/src/main/kotlin/com/apurebase/kgraphql/request/VariablesJson.kt b/kgraphql/src/main/kotlin/com/apurebase/kgraphql/request/VariablesJson.kt index a45685db..2a4221c3 100644 --- a/kgraphql/src/main/kotlin/com/apurebase/kgraphql/request/VariablesJson.kt +++ b/kgraphql/src/main/kotlin/com/apurebase/kgraphql/request/VariablesJson.kt @@ -37,8 +37,8 @@ interface VariablesJson { require(kClass == kType.jvmErasure) { "kClass and KType must represent same class" } return json.let { node -> node[key.value] }?.let { tree -> try { - // Calling [toString] as a hack for now. TODO: Move away from jackson and only depend on kotlinx.serialization - objectMapper.readValue(tree.toString(), kType.toTypeReference()) + // TODO: Move away from jackson and only depend on kotlinx.serialization + objectMapper.treeToValue(tree, kType.toTypeReference()) } catch(e : Exception) { throw if (e is GraphQLError) e else ExecutionException("Failed to coerce $tree as $kType", key, e)