Skip to content

Commit

Permalink
refactor: always generate schema regardless of http adapter existence
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF committed Oct 5, 2022
1 parent f808ce3 commit 1fd5e21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/graphql/lib/drivers/abstract-graphql.driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export abstract class AbstractGraphQLDriver<
protected readonly httpAdapterHost: HttpAdapterHost;

@Inject()
protected readonly applicationConfig: ApplicationConfig;
protected readonly applicationConfig?: ApplicationConfig;

@Inject()
protected readonly graphQlFactory: GraphQLFactory;
Expand Down Expand Up @@ -54,7 +54,7 @@ export abstract class AbstractGraphQLDriver<
}

protected getNormalizedPath(options: TOptions): string {
const prefix = this.applicationConfig.getGlobalPrefix();
const prefix = this.applicationConfig?.getGlobalPrefix() ?? '';
const useGlobalPrefix = prefix && options.useGlobalPrefix;
const gqlOptionsPath = normalizeRoutePath(options.path);
return useGlobalPrefix
Expand Down
10 changes: 5 additions & 5 deletions packages/graphql/lib/graphql.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ export class GraphQLModule<
}

async onModuleInit() {
const httpAdapter = this.httpAdapterHost?.httpAdapter;
if (!httpAdapter) {
return;
}

const options = await this._graphQlAdapter.mergeDefaultOptions(
this.options,
);
Expand All @@ -172,6 +167,11 @@ export class GraphQLModule<
typeDefs: undefined,
};

const httpAdapter = this.httpAdapterHost?.httpAdapter;
if (!httpAdapter) {
return;
}

await this._graphQlAdapter.start(completeOptions);

if (options.path) {
Expand Down

0 comments on commit 1fd5e21

Please sign in to comment.