Closed sothawo closed 5 months ago
ok, I get rid off the unmapped field by setting the JVM name:
@JvmName("getFullName")
fun fullName(): String = "$firstName $lastName"
Then the function is seen as the getter for a property with the name fullName
and the field is mapped.
It looks like at runtime, GraphQL Java matches the function with a predicate for "record-like" methods. Essentially, public methods without arguments that return a value. I've added a similar check that should make this work. It's in 1.3.2-SNAPSHOT
if you're able to give it a try.
Hi Rossen, this works now, no need for the @JvmName
anymore (which is pretty ugly).
Thanks for confirming, much appreciated.
I have the following schema:
This is implemented with a Kotlin data class like
This works fine, I get the data in my GraphQL responses, but
fullName
is reported as unmapped field. For this simple case I can change that to a synthesized getter and the reporting is gone:But we have cases where we need the implementation as a function and cannot switch to a property.
Is there a possibility to recognize these fields as mapped?