Skip to content

Commit

Permalink
Selectively import from graphql.
Browse files Browse the repository at this point in the history
We currently have two imports for `graphql`, one which is using named
exports, and another which imports "*" - which would also get all of those
named imports.

I'm sure that the named imports are just an artifact of VSCode
auto-importing, but let's just use the named imports for their specificity
and clarity as well.
  • Loading branch information
abernix committed Mar 27, 2020
1 parent 8399a56 commit 8bf4fa4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/apollo-server-core/src/requestPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import {
ExecutionArgs,
GraphQLError,
GraphQLFormattedError,
validate as graphqlValidate,
parse as graphqlParse,
execute as graphqlExecute,
GraphQLField,
ResponsePath,
FieldNode,
getNamedType,
GraphQLObjectType,
defaultFieldResolver,
} from 'graphql';
import * as graphql from 'graphql';
import {
GraphQLExtension,
GraphQLExtensionStack,
Expand Down Expand Up @@ -424,7 +432,7 @@ export async function processGraphQLRequest<TContext>(
});

try {
return graphql.parse(query, parseOptions);
return graphqlParse(query, parseOptions);
} finally {
parsingDidEnd();
}
Expand All @@ -439,7 +447,7 @@ export async function processGraphQLRequest<TContext>(
const validationDidEnd = extensionStack.validationDidStart();

try {
return graphql.validate(config.schema, document, rules);
return graphqlValidate(config.schema, document, rules);
} finally {
validationDidEnd();
}
Expand Down Expand Up @@ -474,7 +482,7 @@ export async function processGraphQLRequest<TContext>(
// (eg apollo-engine-reporting) assumes that.
return await config.executor(requestContext);
} else {
return await graphql.execute(executionArgs);
return await graphqlExecute(executionArgs);
}
} finally {
executionDidEnd();
Expand Down

0 comments on commit 8bf4fa4

Please sign in to comment.