https://kotlinlang.org logo
Title
f

Filip Lastic

08/10/2022, 4:07 PM
Hello. I have a question why you don't test jackson serialization of Defined boolean input? see this test https://github.com/ExpediaGroup/graphql-kotlin/blob/master/clients/graphql-kotlin-[…]up/graphql/client/jackson/GraphQLClientJacksonSerializerTest.kt I found this issue in my project, when trying to use
Defined(true)
optional input. This value is skipped in serialization and generated json does not contain my boolean value. I created a draft branch there: https://github.com/ExpediaGroup/graphql-kotlin/pull/1513/files
d

Dariusz Kuc

08/11/2022, 12:59 AM
Boolean is a scalar so it should behave the same as any other scalar (hence no test).
f

Filip Lastic

08/11/2022, 6:47 AM
Hi, thank you for your reply. It is strange because all numbers and strings are serialized correctly, but Boolean value is not included in resulted JSON (it was somehow treated as
undefined
). I do not use custom ObjectMapper
I probably found the issue -> I have boolean named as
isSomething
. This
is
prefix can probably cause some issues https://github.com/FasterXML/jackson-module-kotlin/issues/80
It is strange that it worked with old version of graphql-kotlin
d

Dariusz Kuc

08/11/2022, 2:14 PM
it might be the linked issue that jackson has issues with
is
prefix (it is a Java library so it follows java bean naming convention to locate fields)
f

Filip Lastic

08/12/2022, 6:25 AM
I understand. With this issue using the latest graphql-kotlin is no way because we would need to rename some fields in graphql schema which is a breaking change. I saw this workaround, until jackson fix the issue ->
@get:JsonProperty("_isSomething_")
(see this comment). Maybe we could add this to all inputs generated by graphql-kotlin?
d

Dariusz Kuc

08/14/2022, 11:04 PM
It is the same issue as reported here -> https://github.com/ExpediaGroup/graphql-kotlin/issues/1486 I dont think it will be fixed anytime soon