From 18d95fd7f30bba196f7b0b62abdcff6bcb0eae18 Mon Sep 17 00:00:00 2001 From: Jesse Rosenberger Date: Tue, 12 May 2020 10:50:35 +0000 Subject: [PATCH] comment: Leave traces/suggestions about future work. Ref: https://github.com/apollographql/apollo-server/pull/3988#discussion_r414676152 --- packages/apollo-gateway/src/executeQueryPlan.ts | 8 +++----- packages/apollo-gateway/src/index.ts | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/apollo-gateway/src/executeQueryPlan.ts b/packages/apollo-gateway/src/executeQueryPlan.ts index 72116c8e83d..2c9c3c43787 100644 --- a/packages/apollo-gateway/src/executeQueryPlan.ts +++ b/packages/apollo-gateway/src/executeQueryPlan.ts @@ -88,11 +88,9 @@ export async function executeQueryPlan( }, rootValue: data, variableValues: requestContext.request.variables, - // FIXME: GraphQL extensions currently wraps every field and creates - // a field resolver. Because of this, when using with ApolloServer - // the defaultFieldResolver isn't called. We keep this here - // because it is the correct solution and when ApolloServer removes - // GraphQLExtensions this will be how alias support is maintained + // We have a special field resolver which ensures we support aliases. + // FIXME: It's _possible_ this will change after `graphql-extensions` is + // deprecated, though not certain. See here, also: https://git.io/Jf8cS. fieldResolver: defaultFieldResolverWithAliasSupport, })); } catch (error) { diff --git a/packages/apollo-gateway/src/index.ts b/packages/apollo-gateway/src/index.ts index 1daf6097d69..d74269f0299 100644 --- a/packages/apollo-gateway/src/index.ts +++ b/packages/apollo-gateway/src/index.ts @@ -476,6 +476,10 @@ export class ApolloGateway implements GraphQLService { this.logger.debug('Schema loaded and ready for execution'); + // FIXME: The comment below may change when `graphql-extensions` is + // removed, as it will be soon. It's not clear if this will be temporary, + // as is suggested, after that time, because we still very much need to + // do this special alias resolving. Original comment: // this is a temporary workaround for GraphQLFieldExtensions automatic // wrapping of all fields when using ApolloServer. Here we wrap all fields // with support for resolving aliases as part of the root value which