Skip to content

Commit 2fc8b25

Browse files
authored
Add Apollo Federation V2 support (#2900)
1 parent ef13125 commit 2fc8b25

File tree

17 files changed

+588
-9
lines changed

17 files changed

+588
-9
lines changed

.changeset/khaki-terms-call.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@graphql-inspector/commands': minor
3+
'@graphql-inspector/loaders': minor
4+
'@graphql-inspector/core': minor
5+
'@graphql-inspector/cli': minor
6+
---
7+
8+
Apollo Federation v2 support. Introduced built-in Federation v2 directives and a new CLI flag
9+
--federationV2 to enable processing schemas that use them.

packages/commands/commands/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface GlobalArgs {
3838
leftHeader?: string[];
3939
rightHeader?: string[];
4040
federation?: boolean;
41+
federationV2?: boolean;
4142
aws?: boolean;
4243
method?: string;
4344
}

packages/commands/coverage/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export default createCommand<
106106
const silent = args.silent;
107107
const { headers, token } = parseGlobalArgs(args);
108108
const apolloFederation = args.federation || false;
109+
const apolloFederationV2 = args.federationV2 || false;
109110
const aws = args.aws || false;
110111
const method = args.method?.toUpperCase() || 'POST';
111112

@@ -117,6 +118,7 @@ export default createCommand<
117118
method,
118119
},
119120
apolloFederation,
121+
apolloFederationV2,
120122
aws,
121123
);
122124
const documents = await loaders.loadDocuments(args.documents);

packages/commands/diff/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default createCommand<
137137
const oldSchemaPointer = args.oldSchema;
138138
const newSchemaPointer = args.newSchema;
139139
const apolloFederation = args.federation || false;
140+
const apolloFederationV2 = args.federationV2 || false;
140141
const aws = args.aws || false;
141142
const method = args.method?.toUpperCase() || 'POST';
142143
const { headers, leftHeaders, rightHeaders, token } = parseGlobalArgs(args);
@@ -158,6 +159,7 @@ export default createCommand<
158159
method,
159160
},
160161
apolloFederation,
162+
apolloFederationV2,
161163
aws,
162164
);
163165
const newSchema = await loaders.loadSchema(
@@ -168,6 +170,7 @@ export default createCommand<
168170
method,
169171
},
170172
apolloFederation,
173+
apolloFederationV2,
171174
aws,
172175
);
173176

packages/commands/introspect/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export default createCommand<
8989
const output = args.write!;
9090
const comments = args.comments || false;
9191
const apolloFederation = args.federation || false;
92+
const apolloFederationV2 = args.federationV2 || false;
9293
const aws = args.aws || false;
9394
const method = args.method?.toUpperCase() || 'POST';
9495

@@ -100,6 +101,7 @@ export default createCommand<
100101
method,
101102
},
102103
apolloFederation,
104+
apolloFederationV2,
103105
aws,
104106
);
105107

packages/commands/serve/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default createCommand<
4343
async handler(args) {
4444
const { headers, token } = parseGlobalArgs(args);
4545
const apolloFederation = args.federation || false;
46+
const apolloFederationV2 = args.federationV2 || false;
4647
const aws = args.aws || false;
4748
const method = args.method?.toUpperCase() || 'POST';
4849

@@ -54,6 +55,7 @@ export default createCommand<
5455
method,
5556
},
5657
apolloFederation,
58+
apolloFederationV2,
5759
aws,
5860
);
5961

packages/commands/similar/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export default createCommand<
117117
const type = args.name;
118118
const threshold = args.threshold;
119119
const apolloFederation = args.federation || false;
120+
const apolloFederationV2 = args.federationV2 || false;
120121
const aws = args.aws || false;
121122
const method = args.method?.toUpperCase() || 'POST';
122123

@@ -128,6 +129,7 @@ export default createCommand<
128129
method,
129130
},
130131
apolloFederation,
132+
apolloFederationV2,
131133
aws,
132134
);
133135

packages/commands/validate/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ export default createCommand<
278278
const apollo = args.apollo || false;
279279
const aws = args.aws || false;
280280
const apolloFederation = args.federation || false;
281+
const apolloFederationV2 = args.federationV2 || false;
282+
281283
const method = args.method?.toUpperCase() || 'POST';
282284
const maxDepth = args.maxDepth == null ? undefined : args.maxDepth;
283285
const maxAliasCount = args.maxAliasCount == null ? undefined : args.maxAliasCount;
@@ -311,6 +313,7 @@ export default createCommand<
311313
method,
312314
},
313315
apolloFederation,
316+
apolloFederationV2,
314317
aws,
315318
);
316319
const documents = await loaders.loadDocuments(args.documents, {

0 commit comments

Comments
 (0)