Skip to content

Commit db72dc8

Browse files
committed
GraphQLSchemaProvider#copyReadOnly: simpler, supports CodeRegistry
Fixes support for the code registry (as opposed to type resolvers & data fetchers attached directly to schema objects). ``` Caused by: graphql.AssertException: There must be a type resolver for union ExampleUnion at graphql.Assert.assertNotNull(Assert.java:15) ~[graphql-java-12.0.jar:na] […] at graphql.schema.GraphQLCodeRegistry$Builder.getTypeResolver(GraphQLCodeRegistry.java:230) ~[graphql-java-12.0.jar:na] […] at graphql.schema.SchemaUtil.extractCodeFromTypes(SchemaUtil.java:112) ~[graphql-java-12.0.jar:na] […] at graphql.schema.GraphQLCodeRegistry.transform(GraphQLCodeRegistry.java:139) ~[graphql-java-12.0.jar:na] at graphql.schema.GraphQLSchema$Builder.build(GraphQLSchema.java:413) ~[graphql-java-12.0.jar:na] at graphql.servlet.GraphQLSchemaProvider.copyReadOnly(GraphQLSchemaProvider.java:15) ~[graphql-java-servlet-7.4.1.jar:na] at graphql.servlet.DefaultGraphQLSchemaProvider.<init>(DefaultGraphQLSchemaProvider.java:17) ~[graphql-java-servlet-7.4.1.jar:na] at com.oembedler.moon.graphql.boot.GraphQLWebAutoConfiguration.graphQLSchemaProvider(GraphQLWebAutoConfiguration.java:162) ~[graphql-spring-boot-autoconfigure-5.8.1.jar:na] ``` Signed-off-by: Pierre Carrier <[email protected]>
1 parent b8c567a commit db72dc8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/graphql/servlet/GraphQLSchemaProvider.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package graphql.servlet;
22

3+
import graphql.schema.GraphQLObjectType;
34
import graphql.schema.GraphQLSchema;
45

56
import javax.servlet.http.HttpServletRequest;
@@ -8,10 +9,8 @@
89
public interface GraphQLSchemaProvider {
910

1011
static GraphQLSchema copyReadOnly(GraphQLSchema schema) {
11-
return GraphQLSchema.newSchema()
12-
.query(schema.getQueryType())
13-
.subscription(schema.getSubscriptionType())
14-
.additionalTypes(schema.getAdditionalTypes())
12+
return GraphQLSchema.newSchema(schema)
13+
.mutation((GraphQLObjectType) null)
1514
.build();
1615
}
1716

0 commit comments

Comments
 (0)