You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use graphql-java-tools to wrap classes that are provided by an external library (In this case HAPI FHIR models). My intent is to provide some queries that will return objects that are structured based on an external library, but the FieldResolver is failing in identifying correctly the inheritance for those classes.
Given I'm using an external library I'm not able to modify the structure of those models. At some point, the resolver decides to look for methods on an interface instead of a parent class.
type Meta {
id: String
}
type Device {
meta: Meta
}
type Query {
hello: Device!
}
Resolver:
package com.example.demo;
import graphql.kickstart.tools.GraphQLQueryResolver;
import org.hl7.fhir.dstu3.model.Device;
import org.springframework.stereotype.Component;
@Component
public class DeviceResolver implements GraphQLQueryResolver {
public Device getHello() {
return new Device();
}
}
The error this generates:
Caused by: graphql.kickstart.tools.FieldResolverError: No method or field found as defined in schema <unknown>:2 with any of the following signatures (with or without one of [interface graphql.schema.DataFetchingEnvironment] as the last argument), in priority order:
org.hl7.fhir.instance.model.api.IBaseMetaType.id()
org.hl7.fhir.instance.model.api.IBaseMetaType.getId()
org.hl7.fhir.instance.model.api.IBaseMetaType.id
at graphql.kickstart.tools.FieldResolverScanner.missingFieldResolver(FieldResolverScanner.kt:59) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.FieldResolverScanner.findFieldResolver(FieldResolverScanner.kt:50) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.SchemaClassScanner.scanResolverInfoForPotentialMatches(SchemaClassScanner.kt:244) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.SchemaClassScanner.scanQueueItemForPotentialMatches(SchemaClassScanner.kt:238) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.SchemaClassScanner.scanQueue(SchemaClassScanner.kt:90) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.SchemaClassScanner.scanForClasses(SchemaClassScanner.kt:68) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.SchemaParserBuilder.scan(SchemaParserBuilder.kt:166) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.SchemaParserBuilder.build(SchemaParserBuilder.kt:207) ~[graphql-java-tools-6.0.2.jar:na]
at graphql.kickstart.tools.boot.GraphQLJavaToolsAutoConfiguration.schemaParser(GraphQLJavaToolsAutoConfiguration.java:146) ~[graphql-kickstart-spring-boot-autoconfigure-tools-7.0.1.jar:na]
at graphql.kickstart.tools.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$f9bbdd4.CGLIB$schemaParser$3(<generated>) ~[graphql-kickstart-spring-boot-autoconfigure-tools-7.0.1.jar:na]
at graphql.kickstart.tools.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$f9bbdd4$$FastClassBySpringCGLIB$$10a413ad.invoke(<generated>) ~[graphql-kickstart-spring-boot-autoconfigure-tools-7.0.1.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
at graphql.kickstart.tools.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$f9bbdd4.schemaParser(<generated>) ~[graphql-kickstart-spring-boot-autoconfigure-tools-7.0.1.jar:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
... 139 common frames omitted
This makes sense, given that property is in the parent class of Meta, but this seems to be looking into the interface instead (IBaseMeta). Both the Device class and the Meta class are correct, and I'm able to see the methods from the class correctly:
I am trying to use
graphql-java-tools
to wrap classes that are provided by an external library (In this case HAPI FHIR models). My intent is to provide some queries that will return objects that are structured based on an external library, but the FieldResolver is failing in identifying correctly the inheritance for those classes.Given I'm using an external library I'm not able to modify the structure of those models. At some point, the resolver decides to look for methods on an interface instead of a parent class.
dependencies
schema.graphqls (Simplified to only 1 property)
Resolver:
The error this generates:
This makes sense, given that property is in the parent class of
Meta
, but this seems to be looking into the interface instead (IBaseMeta
). Both the Device class and the Meta class are correct, and I'm able to see the methods from the class correctly:I created a sample repository with the offending code: https://github.com/gpabon-carecloud/graphql-fhir
This commit contains all the modifications from a base Initialz project: gpabon-carecloud/graphql-fhir@68a6d31
The text was updated successfully, but these errors were encountered: