Skip to content

Commit 76df3d1

Browse files
authored
Bump updated federation version to v2.6 (#8710)
* Bump updated federation version to v2.6 * Upgrade version * Restore grpc * Fix E2E
1 parent f63a9d7 commit 76df3d1

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

.changeset/major-rooms-cross.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-mesh/fusion-composition': patch
3+
---
4+
5+
Use the latest compatible federation version v2.6 not v2.3 when upgrading the existing import

e2e/petstore-subgraph/__snapshots__/petstore-subgraph.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`should generate the subgraph schema correctly 1`] = `
4-
"schema @link(url: "https://specs.apollo.dev/link/v1.0") @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@key", "@provides", "@requires", "@external", "@inaccessible", "@shareable", "@extends", "@tag", "@composeDirective"]) @link(url: "https://the-guild.dev/graphql/mesh/spec/v1.0", import: ["@enum", "@httpOperation", "@transport", "@merge", "@extraSchemaDefinitionDirective"]) @composeDirective(name: "@enum") @composeDirective(name: "@httpOperation") @composeDirective(name: "@transport") @composeDirective(name: "@merge") @composeDirective(name: "@extraSchemaDefinitionDirective") {
4+
"schema @link(url: "https://specs.apollo.dev/link/v1.0") @link(url: "https://specs.apollo.dev/federation/v2.6", import: ["@key", "@provides", "@requires", "@external", "@inaccessible", "@shareable", "@extends", "@tag", "@composeDirective"]) @link(url: "https://the-guild.dev/graphql/mesh/spec/v1.0", import: ["@enum", "@httpOperation", "@transport", "@merge", "@extraSchemaDefinitionDirective"]) @composeDirective(name: "@enum") @composeDirective(name: "@httpOperation") @composeDirective(name: "@transport") @composeDirective(name: "@merge") @composeDirective(name: "@extraSchemaDefinitionDirective") {
55
query: Query
66
mutation: Mutation
77
}

examples/v1-next/hive-example/my-rest/typeDefs.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
schema
22
@link(url: "https://specs.apollo.dev/link/v1.0")
33
@link(
4-
url: "https://specs.apollo.dev/federation/v2.3"
4+
url: "https://specs.apollo.dev/federation/v2.6"
55
import: [
66
"@key"
77
"@provides"

packages/fusion/composition/src/federation-utils.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function addFederation2DirectivesToSubgraph(subgraph: GraphQLSchema) {
1919
)
2020
) {
2121
linkDirectives.push({
22-
url: 'https://specs.apollo.dev/federation/v2.3',
22+
url: 'https://specs.apollo.dev/federation/v2.6',
2323
import: [],
2424
});
2525
}
@@ -42,8 +42,14 @@ export function importFederationDirectives(subgraph: GraphQLSchema, directives:
4242
linkDirectives.push(importStatement);
4343
}
4444
// v2.0 is not supported so bump to v2.6
45-
if (importStatement.url === 'https://specs.apollo.dev/federation/v2.0') {
46-
importStatement.url = 'https://specs.apollo.dev/federation/v2.6';
45+
const match = importStatement.url.match(/\/v(\d+)\.(\d+)(?:$|\/)/);
46+
if (match) {
47+
const major = Number(match[1]);
48+
const minor = Number(match[2]);
49+
// Bump only older 2.x (2.0–2.5) to v2.6, leave >=2.6 as-is
50+
if (major === 2 && minor < 6) {
51+
importStatement.url = 'https://specs.apollo.dev/federation/v2.6';
52+
}
4753
}
4854
importStatement.import = [...new Set([...(importStatement.import || []), ...directives])];
4955
const extensions: Record<string, unknown> = (subgraph.extensions ||= {});

packages/fusion/composition/tests/__snapshots__/reproduction.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ exports[`Reproductions GW-164 1`] = `
3939
},
4040
"value": {
4141
"kind": "StringValue",
42-
"value": "https://specs.apollo.dev/federation/v2.3",
42+
"value": "https://specs.apollo.dev/federation/v2.6",
4343
},
4444
},
4545
{

0 commit comments

Comments
 (0)