8000 fix(deps) Replace uses of printSchema · nestjs/graphql@bf088f1 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit bf088f1

Browse files
author
Ian Mobley
committed
fix(deps) Replace uses of printSchema
This is now part of the subgraph dependency and renamed to printSubgraphSchema.
1 parent 827556c commit bf088f1

File tree

3 files changed

+31
-21
lines changed

3 files changed

+31
-21
lines changed

lib/federation/graphql-federation.factory.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,25 @@ export class GraphQLFederationFactory {
9292
private async generateSchema(
9393
options: GqlModuleOptions,
9494
): Promise<GraphQLSchema> {
95-
const {
96-
buildFederatedSchema,
97-
printSchema,
98-
} = loadPackage('@apollo/federation', 'ApolloFederation', () =>
99-
require('@apollo/federation'),
95+
const { buildFederatedSchema } = loadPackage(
96+
'@apollo/federation',
97+
'ApolloFederation',
98+
() => require('@apollo/federation'),
10099
);
101-
102-
const autoGeneratedSchema: GraphQLSchema = await this.gqlSchemaBuilder.buildFederatedSchema(
103-
options.autoSchemaFile,
104-
options,
105-
this.resolversExplorerService.getAllCtors(),
100+
const { printSubgraphSchema } = loadPackage(
101+
'@apollo/subgraph',
102+
'ApolloFederation',
103+
() => require('@apollo/subgraph'),
106104
);
105+
106+
const autoGeneratedSchema: GraphQLSchema =
107+
await this.gqlSchemaBuilder.buildFederatedSchema(
108+
options.autoSchemaFile,
109+
options,
110+
this.resolversExplorerService.getAllCtors(),
111+
);
107112
let executableSchema: GraphQLSchema = buildFederatedSchema({
108-
typeDefs: gql(printSchema(autoGeneratedSchema)),
113+
typeDefs: gql(printSubgraphSchema(autoGeneratedSchema)),
109114
resolvers: this.getResolvers(options.resolvers),
110115
});
111116

lib/federation/graphql-federation.module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ export class GraphQLFederationModule implements OnModuleInit, OnModuleDestroy {
142142
if (!this.httpAdapterHost || !this.httpAdapterHost.httpAdapter) {
143143
return;
144144
}
145-
const { printSchema } = loadPackage(
146-
'@apollo/federation',
145+
const { printSubgraphSchema } = loadPackage(
146+
'@apollo/subgraph',
147147
'ApolloFederation',
148-
() => require('@apollo/federation'),
148+
() => require('@apollo/subgraph'),
149149
);
150150

151151
const { typePaths } = this.options;
@@ -161,7 +161,7 @@ export class GraphQLFederationModule implements OnModuleInit, OnModuleDestroy {
161161

162162
if (this.options.definitions && this.options.definitions.path) {
163163
await this.graphqlFactory.generateDefinitions(
164-
printSchema(apolloOptions.schema),
164+
printSubgraphSchema(apolloOptions.schema),
165165
this.options,
166166
);
167167
}

lib/graphql-definitions.factory.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,16 @@ export class GraphQLDefinitionsFactory {
116116
const typePathDefs = await this.gqlTypesLoader.mergeTypesByPaths(typePaths);
117117
const mergedTypeDefs = extend(typePathDefs, typeDefs);
118118

119-
const {
120-
buildFederatedSchema,
121-
printSchema,
122-
} = loadPackage('@apollo/federation', 'ApolloFederation', () =>
123-
require('@apollo/federation'),
119+
const { buildFederatedSchema } = loadPackage(
120+
'@apollo/federation',
121+
'ApolloFederation',
122+
() => require('@apollo/federation'),
123+
);
124+
125+
const { printSubgraphSchema } = loadPackage(
126+
'@apollo/subgraph',
127+
'ApolloFederation',
128+
() => require('@apollo/subgraph'),
124129
);
125130

126131
const schema = buildFederatedSchema([
@@ -133,7 +138,7 @@ export class GraphQLDefinitionsFactory {
133138
]);
134139
const tsFile = await this.gqlAstExplorer.explore(
135140
gql`
136-
${printSchema(schema)}
141+
${printSubgraphSchema(schema)}
137142
`,
138143
path,
139144
outputAs,

0 commit comments

Comments
 (0)
0