jvmMain.graphql.coercion.NodeInputCoercer.kt Maven / Gradle / Ivy
The newest version!
package io.fluidsonic.raptor.graphql.internal
import io.fluidsonic.graphql.*
import io.fluidsonic.stdlib.*
internal object NodeInputCoercer : GNodeInputCoercer {
override fun GNodeInputCoercerContext.coerceNodeInput(input: Any?): Any? {
val kotlinType = argumentDefinition?.raptorArgument?.kotlinType
val expectsMaybe = kotlinType?.classifier == Maybe::class
if (expectsMaybe && input == null)
return Maybe.nothing
return next()
}
}