Dariusz Kuc
05/20/2021, 4:00 AMnull
3) value set
I used a sealed class and custom Jackson deserializer in the past (link) but now I'm looking into serialization and need to support kotlinx-serialization
. I tried something using custom serializer and "skipping" the encode part when I process an instance of Undefined
sealed class but that produces me a broken JSON, e.g. given
data class Wrapper(val name: OptionalInput<String>)
I end up with { "name": }
. Any ideas? I don't see any option to skip element in the JsonEncoder
christophsturm
05/20/2021, 8:24 AMKarlo Lozovina
05/20/2021, 10:37 AMjschneider
05/20/2021, 11:18 AMchristophsturm
05/20/2021, 11:41 AMDariusz Kuc
05/20/2021, 2:49 PM!
at the end of the type means not-null)
type Query {
foo(bar: String): String!
}
clients could run following
• query { foo }
• query { foo(bar = null) }
• query { foo(bar = "baz") }
As a client you could create separate queries for unspecified/specified cases but if you have multiple optional arguments in a query it would mean you would have to create 2^number_arguments
permutations which is not really feasible.Dariusz Kuc
05/24/2021, 3:16 AMUndefined
and then configure encodeDefaults = false
Dariusz Kuc
05/24/2021, 10:07 PM