diff --git a/packages/apollo/lib/drivers/apollo-federation.driver.ts b/packages/apollo/lib/drivers/apollo-federation.driver.ts index 86f8b0abfb..cf6631d892 100644 --- a/packages/apollo/lib/drivers/apollo-federation.driver.ts +++ b/packages/apollo/lib/drivers/apollo-federation.driver.ts @@ -20,7 +20,7 @@ export class ApolloFederationDriver extends ApolloBaseDriver { } async generateSchema(options: ApolloDriverConfig): Promise { - return await this.graphqlFederationFactory.mergeWithSchema(options); + return await this.graphqlFederationFactory.generateSchema(options); } public async start(options: ApolloDriverConfig): Promise { diff --git a/packages/graphql/lib/drivers/abstract-graphql.driver.ts b/packages/graphql/lib/drivers/abstract-graphql.driver.ts index 3abb73a33b..72e2944e44 100644 --- a/packages/graphql/lib/drivers/abstract-graphql.driver.ts +++ b/packages/graphql/lib/drivers/abstract-graphql.driver.ts @@ -38,7 +38,7 @@ export abstract class AbstractGraphQLDriver< } public async generateSchema(options: TOptions): Promise { - return await this.graphQlFactory.mergeWithSchema(options); + return await this.graphQlFactory.generateSchema(options); } public subscriptionWithFilter( diff --git a/packages/graphql/lib/federation/graphql-federation.factory.ts b/packages/graphql/lib/federation/graphql-federation.factory.ts index 0e15fc9b33..644aacd048 100644 --- a/packages/graphql/lib/federation/graphql-federation.factory.ts +++ b/packages/graphql/lib/federation/graphql-federation.factory.ts @@ -48,7 +48,7 @@ export class GraphQLFederationFactory { private readonly typeDefsDecoratorFactory: TypeDefsDecoratorFactory, ) {} - async mergeWithSchema( + async generateSchema( options: T = {} as T, buildFederatedSchema?: ( options: BuildFederatedSchemaOptions, @@ -59,7 +59,10 @@ export class GraphQLFederationFactory { let schema: GraphQLSchema; if (options.autoSchemaFile) { - schema = await this.generateSchema(options, buildFederatedSchema); + schema = await this.generateSchemaFromCodeFirst( + options, + buildFederatedSchema, + ); } else if (isEmpty(options.typeDefs)) { schema = options.schema; } else { @@ -85,7 +88,7 @@ export class GraphQLFederationFactory { ]); } - private async generateSchema( + private async generateSchemaFromCodeFirst( options: T, buildFederatedSchema?: ( options: BuildFederatedSchemaOptions, diff --git a/packages/graphql/lib/graphql.factory.ts b/packages/graphql/lib/graphql.factory.ts index bec039f6fa..ca3ebd10bb 100644 --- a/packages/graphql/lib/graphql.factory.ts +++ b/packages/graphql/lib/graphql.factory.ts @@ -29,7 +29,7 @@ export class GraphQLFactory { private readonly gqlSchemaBuilder: GraphQLSchemaBuilder, ) {} - async mergeWithSchema( + async generateSchema( options: T = { typeDefs: [] } as T, ): Promise { const resolvers = this.resolversExplorerService.explore(); @@ -100,7 +100,7 @@ export class GraphQLFactory { return schema; } - overrideOrExtendResolvers( + private overrideOrExtendResolvers( executableSchemaConfig: GraphQLSchemaConfig, autoGeneratedSchemaConfig: GraphQLSchemaConfig, ): GraphQLSchemaConfig { diff --git a/packages/mercurius/lib/drivers/mercurius-federation.driver.ts b/packages/mercurius/lib/drivers/mercurius-federation.driver.ts index 5933643fba..933edeb57d 100644 --- a/packages/mercurius/lib/drivers/mercurius-federation.driver.ts +++ b/packages/mercurius/lib/drivers/mercurius-federation.driver.ts @@ -30,7 +30,7 @@ export class MercuriusFederationDriver extends AbstractGraphQLDriver { - return await this.graphqlFederationFactory.mergeWithSchema( + return await this.graphqlFederationFactory.generateSchema( options, buildMercuriusFederatedSchema, );