55
66import java .util .ArrayList ;
77import java .util .Arrays ;
8+ import java .util .Collections ;
89import java .util .List ;
910import java .util .Map ;
1011import java .util .Set ;
1112
13+ import graphql .Assert ;
1214import graphql .Directives ;
1315
1416public class GraphQLSchema {
@@ -19,14 +21,15 @@ public class GraphQLSchema {
1921 private Set <GraphQLType > dictionary ;
2022
2123 public GraphQLSchema (GraphQLObjectType queryType ) {
22- this (queryType , null , null );
24+ this (queryType , null , Collections .< GraphQLType > emptySet () );
2325 }
2426
2527 public Set <GraphQLType > getDictionary () {
2628 return dictionary ;
2729 }
2830
2931 public GraphQLSchema (GraphQLObjectType queryType , GraphQLObjectType mutationType , Set <GraphQLType > dictionary ) {
32+ assertNotNull (dictionary , "dictionary can't be null" );
3033 assertNotNull (queryType , "queryType can't be null" );
3134 this .queryType = queryType ;
3235 this .mutationType = mutationType ;
@@ -86,10 +89,11 @@ public Builder mutation(GraphQLObjectType mutationType) {
8689 }
8790
8891 public GraphQLSchema build () {
89- return build (null );
92+ return build (Collections .< GraphQLType > emptySet () );
9093 }
9194
9295 public GraphQLSchema build (Set <GraphQLType > dictionary ) {
96+ Assert .assertNotNull (dictionary , "dictionary can't be null" );
9397 GraphQLSchema graphQLSchema = new GraphQLSchema (queryType , mutationType , dictionary );
9498 new SchemaUtil ().replaceTypeReferences (graphQLSchema );
9599 return graphQLSchema ;
0 commit comments