@@ -97,6 +97,36 @@ export function buildClientSchema(
97
97
}
98
98
}
99
99
100
+ // Get the root Query, Mutation, and Subscription types.
101
+ const queryType = schemaIntrospection . queryType
102
+ ? getObjectType ( schemaIntrospection . queryType )
103
+ : null ;
104
+
105
+ const mutationType = schemaIntrospection . mutationType
106
+ ? getObjectType ( schemaIntrospection . mutationType )
107
+ : null ;
108
+
109
+ const subscriptionType = schemaIntrospection . subscriptionType
110
+ ? getObjectType ( schemaIntrospection . subscriptionType )
111
+ : null ;
112
+
113
+ // Get the directives supported by Introspection, assuming empty-set if
114
+ // directives were not queried for.
115
+ const directives = schemaIntrospection . directives
116
+ ? schemaIntrospection . directives . map ( buildDirective )
117
+ : [ ] ;
118
+
119
+ // Then produce and return a Schema with these types.
120
+ return new GraphQLSchema ( {
121
+ query : queryType ,
122
+ mutation : mutationType ,
123
+ subscription : subscriptionType ,
124
+ types : objectValues ( typeMap ) ,
125
+ directives,
126
+ assumeValid : options && options . assumeValid ,
127
+ allowedLegacyNames : options && options . allowedLegacyNames ,
128
+ } ) ;
129
+
100
130
// Given a type reference in introspection, return the GraphQLType instance.
101
131
// preferring cached instances before building new instances.
102
132
function getType ( typeRef : IntrospectionTypeRef ) : GraphQLType {
@@ -356,34 +386,4 @@ export function buildClientSchema(
356
386
args : buildInputValueDefMap ( directiveIntrospection . args ) ,
357
387
} ) ;
358
388
}
359
-
360
- // Get the root Query, Mutation, and Subscription types.
361
- const queryType = schemaIntrospection . queryType
362
- ? getObjectType ( schemaIntrospection . queryType )
363
- : null ;
364
-
365
- const mutationType = schemaIntrospection . mutationType
366
- ? getObjectType ( schemaIntrospection . mutationType )
367
- : null ;
368
-
369
- const subscriptionType = schemaIntrospection . subscriptionType
370
- ? getObjectType ( schemaIntrospection . subscriptionType )
371
- : null ;
372
-
373
- // Get the directives supported by Introspection, assuming empty-set if
374
- // directives were not queried for.
375
- const directives = schemaIntrospection . directives
376
- ? schemaIntrospection . directives . map ( buildDirective )
377
- : [ ] ;
378
-
379
- // Then produce and return a Schema with these types.
380
- return new GraphQLSchema ( {
381
- query : queryType ,
382
- mutation : mutationType ,
383
- subscription : subscriptionType ,
384
- types : objectValues ( typeMap ) ,
385
- directives,
386
- assumeValid : options && options . assumeValid ,
387
- allowedLegacyNames : options && options . allowedLegacyNames ,
388
- } ) ;
389
389
}
0 commit comments