Description
When I try to get schema from endpoint by Default GraphQL Endpoint
-> Get GraphQL Schema from Endpoint (introspection)
from service which uses GraphQL SPQR I get error:
GraphQL Introspection Error
A valid schema could not be built using the introspection result. The endpoint may not follow the GraphQL Specification. The error was:
"errors=[The field type 'Long' is not present when resolving type 'Project' [@-1:-1]]".
Stack trace:
SchemaProblem{errors=[The field type 'Long' is not present when resolving type 'Project' [@-1:-1]]}
at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:270)
at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:246)
at com.intellij.lang.jsgraphql.ide.editor.GraphQLIntrospectionHelper.buildIntrospectionSchema(GraphQLIntrospectionHelper.java:300)
at com.intellij.lang.jsgraphql.ide.editor.GraphQLIntrospectionHelper.printIntrospectionJsonAsGraphQL(GraphQLIntrospectionHelper.java:264)
at com.intellij.lang.jsgraphql.ide.editor.GraphQLIntrospectionHelper$2.lambda$run$0(GraphQLIntrospectionHelper.java:148)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:668)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
In services which doesn't use GraphQL SPQR getting schema by plugin works.
Based on this, you can think it's the GraphQL SPQR's fault. But schema can be got by other tools, for example by get-graphql-schema or graphql-cli (based on this answer).
Example with GraphQL SPQR (error only in plugin case)
(uses GraphQL Java Spring)
- Download https://github.com/leangen/graphql-spqr-samples
- Create
.graphqlconfig
for plugin (http://localhost:8000/graphql
- pay attention to port!) - Run Spring Boot
StarterDemoApplication
(from projectspring-boot-starter-sample
). - Try
Get GraphQL Schema from Endpoint (introspection)
in plugin and get error. - Try
get-graphql-schema http://localhost:8000/graphql
and get schema.
Example without GraphQL SPQR (without error in both case)
(uses GraphQL Spring Boot Starter)
- Download https://github.com/graphql-java/tutorials
- Create
.graphqlconfig
for plugin (http://localhost:8080/graphql
) - Run Spring Boot
BookDetailsApplication
(from projectbook-details
). - Try
Get GraphQL Schema from Endpoint (introspection)
in plugin and get schema. - Try
get-graphql-schema http://localhost:8080/graphql
and get schema.
Example with GraphQL SPQR, but without Spring Boot (error only in plugin case)
(to eliminate fault in GraphQL Spring Boot Starter; it is pure GraphQL SPQR and GraphQL Java - so I think Spring Boot starter doesn't matter)
- Download https://github.com/mkczyk/hackernews-graphql-java (based on last step of this tutorial)
.graphqlconfig
for plugin is created (http://localhost:8000/graphql
)- Run
mvn jetty:run
(from projecthackernews-graphql-java
). - Try
Get GraphQL Schema from Endpoint (introspection)
in plugin and get error. - Try
get-graphql-schema http://localhost:8000/graphql
and get schema.
But in the last one example I get different error than first example:
GraphQL Introspection Error
A valid schema could not be built using the introspection result. The endpoint may not follow the GraphQL Specification. The error was:
"errors=[The field input type 'BigDecimal' is not present when resolving type 'QUERY_ROOT' [@-1:-1], The field input type 'BigDecimal' is not present when resolving type 'QUERY_ROOT' [@-1:-1]]".
Stack trace:
SchemaProblem{errors=[The field input type 'BigDecimal' is not present when resolving type 'QUERY_ROOT' [@-1:-1], The field input type 'BigDecimal' is not present when resolving type 'QUERY_ROOT' [@-1:-1]]}
at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:270)
at graphql.schema.idl.SchemaGenerator.makeExecutableSchema(SchemaGenerator.java:246)
at com.intellij.lang.jsgraphql.ide.editor.GraphQLIntrospectionHelper.buildIntrospectionSchema(GraphQLIntrospectionHelper.java:300)
at com.intellij.lang.jsgraphql.ide.editor.GraphQLIntrospectionHelper.printIntrospectionJsonAsGraphQL(GraphQLIntrospectionHelper.java:264)
at com.intellij.lang.jsgraphql.ide.editor.GraphQLIntrospectionHelper$2.lambda$run$0(GraphQLIntrospectionHelper.java:148)
at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:315)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419)
at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:762)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:732)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:668)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
It's look like problem with getting custom scalars defined in GraphQL SPQR.
v.2.0.0-beta-1
IntelliJ IDEA 2018.3.5 Ultimate Edition