Skip to content

Commit bdfd1c6

Browse files
buildClientSchema: move inner functions to follow return (#1678)
1 parent 183ff32 commit bdfd1c6

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/utilities/buildClientSchema.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,36 @@ export function buildClientSchema(
9797
}
9898
}
9999

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+
100130
// Given a type reference in introspection, return the GraphQLType instance.
101131
// preferring cached instances before building new instances.
102132
function getType(typeRef: IntrospectionTypeRef): GraphQLType {
@@ -356,34 +386,4 @@ export function buildClientSchema(
356386
args: buildInputValueDefMap(directiveIntrospection.args),
357387
});
358388
}
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-
});
389389
}

0 commit comments

Comments
 (0)