Skip to content

Commit e30f085

Browse files
committed
refactor: always generate schema regardless of http adapter existence
1 parent a198c6a commit e30f085

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/graphql/lib/drivers/abstract-graphql.driver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export abstract class AbstractGraphQLDriver<
1313
protected readonly httpAdapterHost: HttpAdapterHost;
1414

1515
@Inject()
16-
protected readonly applicationConfig: ApplicationConfig;
16+
protected readonly applicationConfig?: ApplicationConfig;
1717

1818
@Inject()
1919
protected readonly graphQlFactory: GraphQLFactory;
@@ -54,7 +54,7 @@ export abstract class AbstractGraphQLDriver<
5454
}
5555

5656
protected getNormalizedPath(options: TOptions): string {
57-
const prefix = this.applicationConfig.getGlobalPrefix();
57+
const prefix = this.applicationConfig?.getGlobalPrefix() ?? '';
5858
const useGlobalPrefix = prefix && options.useGlobalPrefix;
5959
const gqlOptionsPath = normalizeRoutePath(options.path);
6060
return useGlobalPrefix

packages/graphql/lib/graphql.module.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,6 @@ export class GraphQLModule<
146146
}
147147

148148
async onModuleInit() {
149-
const httpAdapter = this.httpAdapterHost?.httpAdapter;
150-
if (!httpAdapter) {
151-
return;
152-
}
153-
154149
const options = await this._graphQlAdapter.mergeDefaultOptions(
155150
this.options,
156151
);
@@ -172,6 +167,11 @@ export class GraphQLModule<
172167
typeDefs: undefined,
173168
};
174169

170+
const httpAdapter = this.httpAdapterHost?.httpAdapter;
171+
if (!httpAdapter) {
172+
return;
173+
}
174+
175175
await this._graphQlAdapter.start(completeOptions);
176176

177177
if (options.path) {

0 commit comments

Comments
 (0)