https://kotlinlang.org logo
#graphql-kotlin
Title
# graphql-kotlin
t

Tobias

02/04/2022, 1:52 PM
I have some problems with nullability (not "undefinability"). I don't believe it's kotlin-graphql's fault, I just want to confirm the behaviour. If I understand this correct as per https://opensource.expediagroup.com/graphql-kotlin/docs/schema-generator/execution/optional-undefined-arguments/ I should not get NPE when doing
fun optionalInput(value: String? = null): String? = value
where
value
is
null
in the graphql variables, right? I should just get the
value
of
null
?
d

Dariusz Kuc

02/04/2022, 2:42 PM
yes if you don't specify
value
it should use the provided default value of
null
if you are getting NPE -> are you setting the defaults?
t

Tobias

02/04/2022, 2:42 PM
yes, but like I said, I don't believe it's kotlin-graphql's fault
I get it in the Armeria graphql wrapper that seems to assume all values sent are non-null. I just wanted to confirm I didn't misunderstand something
Either way, thanks for the confirmation
👍 1
Although the question is what happens when I send in
null
"`undefined`" works, it's the
null
that makes things go boom
d

Dariusz Kuc

02/04/2022, 2:48 PM
maybe it doesn't make a distinction between defined,
null
and undefined?
e.g. Kotlin/Java by itself does not
JS does
t

Tobias

02/04/2022, 4:26 PM
Just confirmed it's a bug in Armeria
I'll write a bug report for them. Thanks for your help!
Yes, the client is Apollo JS
Armeria make a map with all the values in parameters object. Sending
undefined
in Apollo is fine, because then it literally does not exist in the sent data. Null is not, because for some reason the map implementation used by Armeria does not allow null values.
d

Dariusz Kuc

02/04/2022, 4:35 PM
👍
2 Views