Dariusz Kuc
12/18/2020, 4:08 AMJsonDeserializer.getNullValue(ctxt: DeserializationContext)
?
i.e. I wrote a custom deserializer (https://github.com/ExpediaGroup/graphql-kotlin/blob/master/graphql-kotlin-schema-g[…]main/kotlin/com/expediagroup/graphql/execution/OptionalInput.kt) to be able to distinguish between NO_VALUE and explicit NULL value for the field and while it works fine for the root fields, it does not work for nested fields.
issue is that for nested fields ctxt.parser.parsingContext
in the below will still point to a parent context which means my check succeeds even though there is no value specified
override fun getNullValue(ctxt: DeserializationContext): OptionalInput<*> {
return if (ctxt.parser.parsingContext.currentName != null) {
OptionalInput.Defined(null)
} else {
OptionalInput.Undefined
}
}
Anyone knows whether there is a way to explicitly check whether the name in the parsing context matches the field name we are trying to deserialize? I was looking through parser and parsing context but nothing jumped out…. 😢