Skip to content

Commit

Permalink
fix: accept fed 2.7 supergraphs (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszkuc committed Feb 5, 2024
1 parent a700e28 commit 70269cd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/compatibility/src/composeSupergraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { readFile, writeFile } from 'fs/promises';
import { createWriteStream } from 'fs';

const COMPOSITION_VERSION =
process.env['APOLLO_ROVER_DEV_COMPOSITION_VERSION'] ?? '2.5.5';
process.env['APOLLO_ROVER_DEV_COMPOSITION_VERSION'] ?? '2.7.1';
const ROUTER_VERSION =
process.env['APOLLO_ROVER_DEV_ROUTER_VERSION'] ?? '1.30.1';
process.env['APOLLO_ROVER_DEV_ROUTER_VERSION'] ?? '1.39.0';
const roverDebug = debug('rover');

/**
Expand Down
11 changes: 9 additions & 2 deletions packages/compatibility/src/tests/link.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,32 @@ test('@link', async () => {
fedLinkCount++;

const federationVersion = linkUrl.match(linkUrlSpecVersionRegex)[1];
// only federation v2.0 and v2.1 are supported
expect(federationVersion).toMatch(/2\.0|2\.1|2\.2|2\.3|2\.4|2\.5/);
// federation v2.0 through v2.7 are supported
expect(federationVersion).toMatch(
/2\.0|2\.1|2\.2|2\.3|2\.4|2\.5|2\.6|2\.7/,
);

const linkImportsRegex = /import:\[(.+?)\]/;
if (linkImportsRegex.test(element)) {
// verify federation imports
const expected = [
'@authenticated',
'@composeDirective',
'@extends',
'@external',
'@inaccessible',
'@interfaceObject',
'@key',
'@override',
'@policy',
'@provides',
'@requires',
'@requiresScopes',
'@shareable',
'@tag',
'FieldSet',
'Scope',
'Policy',
];

const linkImportsMatch = element.match(linkImportsRegex);
Expand Down
2 changes: 1 addition & 1 deletion packages/compatibility/supergraph-compose.yaml.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
router:
image: ghcr.io/apollographql/router:v1.30.1
image: ghcr.io/apollographql/router:v1.39.0
volumes:
- ${SCRIPT_DIR}/router.yaml:/dist/config/router.yaml
- ./supergraph.graphql:/dist/config/supergraph.graphql
Expand Down

0 comments on commit 70269cd

Please sign in to comment.