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
{{ message }}
Repository navigation
Custom scalars are not properly scanned when only used in input types #355
I have some trouble with custom scalars that are only used in input types. I used the [https://github.com/graphql-java-kickstart/graphql-java-tools/tree/master/example](example from this repository) to recreate this problem. I've just added a scalar to the existing input type,
Schema:
scalar Foo
input CreateHumanInput {
# The name of the human
name: String
# The home planet of the human, or null if unknown
homePlanet: String
# custom scalar
foo: Foo
}
When I start the application I get the following exception (that's just the root cause)
Caused by: com.coxautodev.graphql.tools.SchemaError: Expected type 'Foo' to be a GraphQLInputType, but it wasn't! Was a type only permitted for object types incorrectly used as an input type, or vice-versa?
at com.coxautodev.graphql.tools.SchemaParser.determineType(SchemaParser.kt:331) ~[graphql-java-tools-5.5.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParser.determineInputType(SchemaParser.kt:319) ~[graphql-java-tools-5.5.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParser.createInputObject(SchemaParser.kt:196) ~[graphql-java-tools-5.5.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParser.parseSchemaObjects(SchemaParser.kt:105) ~[graphql-java-tools-5.5.0.jar:na]
at com.coxautodev.graphql.tools.SchemaParser.makeExecutableSchema(SchemaParser.kt:130) ~[graphql-java-tools-5.5.0.jar:na]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration.graphQLSchema(GraphQLJavaToolsAutoConfiguration.java:116) ~[graphql-spring-boot-autoconfigure-5.5.0.jar:na]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$bd848caf.CGLIB$graphQLSchema$1(<generated>) ~[graphql-spring-boot-autoconfigure-5.5.0.jar:na]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$bd848caf$$FastClassBySpringCGLIB$$2867ec26.invoke(<generated>) ~[graphql-spring-boot-autoconfigure-5.5.0.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.11.RELEASE.jar:5.1.11.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.11.RELEASE.jar:5.1.11.RELEASE]
at com.oembedler.moon.graphql.boot.GraphQLJavaToolsAutoConfiguration$$EnhancerBySpringCGLIB$$bd848caf.graphQLSchema(<generated>) ~[graphql-spring-boot-autoconfigure-5.5.0.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_212]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_212]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_212]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.11.RELEASE.jar:5.1.11.RELEASE]
... 90 common frames omitted
In addition to the exception there is also a warning as one of the first log statements
Cannot find definition for field 'foo: Foo' on input type 'CreateHumanInput' -> java.util.Map. or add a class to represent your input type instead of a Map.
The example in the repository uses version 5.5.0. I also tried version 5.7.1, which I use in the actual project. But that didn't change anything.
I also tried it with an explicitly defined SchemaParser.
changed the title [-]custom scalars are not properly scanned when only used in input types[/-][+]Custom scalars are not properly scanned when only used in input types[/+]on Feb 4, 2020
Activity
[-]custom scalars are not properly scanned when only used in input types[/-][+]Custom scalars are not properly scanned when only used in input types[/+]ubarua123 commentedon Feb 13, 2020
Did you find a solution to this? I am facing the same issue
vojtapol commentedon Feb 13, 2020
This looks like a bug. We would welcome a PR that would fix this.
tedepstein commentedon Sep 8, 2020
Similar issue here, but with enums, not scalars.The problem I had with enums turned out to be a field naming mismatch. Pilot error of a sort. So please disregard the above comment.