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 2d13545
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 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,10 @@ import {
ExecutionArgs,
GraphQLError,
GraphQLFormattedError,
validate as graphqlValidate,
parse as graphqlParse,
execute as graphqlExecute,
} from 'graphql';
import * as graphql from 'graphql';
import {
GraphQLExtension,
GraphQLExtensionStack,
Expand Down Expand Up @@ -424,7 +426,7 @@ export async function processGraphQLRequest<TContext>(
});

try {
return graphql.parse(query, parseOptions);
return graphqlParse(query, parseOptions);
} finally {
parsingDidEnd();
}
Expand All @@ -439,7 +441,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 +476,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 2d13545

Please sign in to comment.