From 2d135457a3139e74c97322360fb2d29a56a22059 Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Thu, 26 Mar 2020 21:04:59 +0200 Subject: [PATCH] Selectively import from `graphql`. 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. --- packages/apollo-server-core/src/requestPipeline.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/apollo-server-core/src/requestPipeline.ts b/packages/apollo-server-core/src/requestPipeline.ts index ae839785d3a..07a640c1924 100644 --- a/packages/apollo-server-core/src/requestPipeline.ts +++ b/packages/apollo-server-core/src/requestPipeline.ts @@ -7,8 +7,10 @@ import { ExecutionArgs, GraphQLError, GraphQLFormattedError, + validate as graphqlValidate, + parse as graphqlParse, + execute as graphqlExecute, } from 'graphql'; -import * as graphql from 'graphql'; import { GraphQLExtension, GraphQLExtensionStack, @@ -424,7 +426,7 @@ export async function processGraphQLRequest( }); try { - return graphql.parse(query, parseOptions); + return graphqlParse(query, parseOptions); } finally { parsingDidEnd(); } @@ -439,7 +441,7 @@ export async function processGraphQLRequest( const validationDidEnd = extensionStack.validationDidStart(); try { - return graphql.validate(config.schema, document, rules); + return graphqlValidate(config.schema, document, rules); } finally { validationDidEnd(); } @@ -474,7 +476,7 @@ export async function processGraphQLRequest( // (eg apollo-engine-reporting) assumes that. return await config.executor(requestContext); } else { - return await graphql.execute(executionArgs); + return await graphqlExecute(executionArgs); } } finally { executionDidEnd();