in graphql-dgs-codegen-shared-core/src/main/kotlin/com/netflix/graphql/dgs/client/codegen/InputValueSerializer.kt [65:89]
override fun toValue(input: Any?): Value<*> {
if (input == null) {
return NullValue.newNullValue().build()
}
val optionalValue = getOptionalValue(input)
if (optionalValue.isPresent) {
return optionalValue.get()
}
val classes = (sequenceOf(input::class) + input::class.allSuperclasses.asSequence()) - Any::class
val propertyValues = getPropertyValues(classes, input)
val objectFields =
propertyValues
.asSequence()
.filter { (_, value) -> value != null }
.map { (name, value) -> ObjectField(name, toValue(value)) }
.toList()
return ObjectValue
.newObjectValue()
.objectFields(objectFields)
.build()
}