Skip to content

Commit

Permalink
refactor: rename mergeWithSchema to generateSchema
Browse files Browse the repository at this point in the history
This better matches the method signature.
  • Loading branch information
CarsonF committed Oct 5, 2022
1 parent 1fd5e21 commit 9f8bc82
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/apollo/lib/drivers/apollo-federation.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ApolloFederationDriver extends ApolloBaseDriver {
}

async generateSchema(options: ApolloDriverConfig): Promise<GraphQLSchema> {
return await this.graphqlFederationFactory.mergeWithSchema(options);
return await this.graphqlFederationFactory.generateSchema(options);
}

public async start(options: ApolloDriverConfig): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/lib/drivers/abstract-graphql.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export abstract class AbstractGraphQLDriver<
}

public async generateSchema(options: TOptions): Promise<GraphQLSchema> {
return await this.graphQlFactory.mergeWithSchema(options);
return await this.graphQlFactory.generateSchema(options);
}

public subscriptionWithFilter(
Expand Down
9 changes: 6 additions & 3 deletions packages/graphql/lib/federation/graphql-federation.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class GraphQLFederationFactory {
private readonly typeDefsDecoratorFactory: TypeDefsDecoratorFactory,
) {}

async mergeWithSchema<T extends GqlModuleOptions>(
async generateSchema<T extends GqlModuleOptions>(
options: T = {} as T,
buildFederatedSchema?: (
options: BuildFederatedSchemaOptions,
Expand All @@ -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 {
Expand All @@ -85,7 +88,7 @@ export class GraphQLFederationFactory {
]);
}

private async generateSchema<T extends GqlModuleOptions>(
private async generateSchemaFromCodeFirst<T extends GqlModuleOptions>(
options: T,
buildFederatedSchema?: (
options: BuildFederatedSchemaOptions,
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/lib/graphql.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class GraphQLFactory {
private readonly gqlSchemaBuilder: GraphQLSchemaBuilder,
) {}

async mergeWithSchema<T extends GqlModuleOptions>(
async generateSchema<T extends GqlModuleOptions>(
options: T = { typeDefs: [] } as T,
): Promise<GraphQLSchema> {
const resolvers = this.resolversExplorerService.explore();
Expand Down Expand Up @@ -100,7 +100,7 @@ export class GraphQLFactory {
return schema;
}

overrideOrExtendResolvers(
private overrideOrExtendResolvers(
executableSchemaConfig: GraphQLSchemaConfig,
autoGeneratedSchemaConfig: GraphQLSchemaConfig,
): GraphQLSchemaConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class MercuriusFederationDriver extends AbstractGraphQLDriver<MercuriusDr
public override async generateSchema(
options: MercuriusDriverConfig,
): Promise<GraphQLSchema> {
return await this.graphqlFederationFactory.mergeWithSchema(
return await this.graphqlFederationFactory.generateSchema(
options,
buildMercuriusFederatedSchema,
);
Expand Down

0 comments on commit 9f8bc82

Please sign in to comment.