rocketraman
02/15/2022, 5:25 AMdata class SomeSuccessType(
val foo: Foo,
@property:GraphQLIgnore val bar: suspend () -> Bar?,
) {
suspend fun bar() = bar.invoke()
}
With this approach my data model does not need to know anything about the various services and such being used to look up this data (like in the example given at https://opensource.expediagroup.com/graphql-kotlin/docs/server/data-loaders, the model class needs a reference to friendService
and userService
, which I think is messy to say the least). Instead, the loader logic here exists outside the data class/model and is simply injected via a function.
However, when trying this approach, I am confronted with:
Exception in thread "main" kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Cannot calculate JVM erasure for type: suspend () -> Bar?
at kotlin.reflect.jvm.KTypesJvm.getJvmErasure(KTypesJvm.kt:36)
at com.expediagroup.graphql.generator.internal.extensions.KTypeExtensionsKt.getKClass(kTypeExtensions.kt:38)
at com.expediagroup.graphql.generator.internal.extensions.KTypeExtensionsKt.getQualifiedName(kTypeExtensions.kt:73)
...
Any work-around for this? If not, what other techniques are people using to do data loading without all the messiness?isValidProperty
in the generator hooks to exclude that proeprty works, but I would have thought any @GraphQLIgnore
annotated property would already have been excluded by default?private
works. Also manually looking for the GraphQLIgnore
annotation in isValidProperty
and excluding it works, so it certainly seems like a bug.Dariusz Kuc
02/15/2022, 4:21 PMprivate
works then it sounds like a bugrocketraman
02/15/2022, 6:47 PM