Skip to content

Commit 6569205

Browse files
enisdenjokamilkisiela
authored andcommitted
begin test
1 parent 6848cc3 commit 6569205

File tree

16 files changed

+287
-65
lines changed

16 files changed

+287
-65
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ This repository contains a set of tests to evaluate and compare the compatibilit
1010

1111
| Gateway | Compatibility | Test Cases | Test Suites |
1212
| :-------------------------------------------------------------: | :-----------: | :----------: | :---------: |
13-
| [Hive Gateway](https://the-guild.dev/graphql/hive/docs/gateway) | 100.00% | 🟢 179 | 🟢 41 |
14-
| [Apollo Router](https://www.apollographql.com/) | 97.77% | 🟢 175 ❌ 4 | 🟢 39 ❌ 2 |
15-
| [Apollo Gateway](https://www.apollographql.com/) | 97.21% | 🟢 174 ❌ 5 | 🟢 38 ❌ 3 |
16-
| [Cosmo Router](https://wundergraph.com) | 94.97% | 🟢 170 ❌ 9 | 🟢 36 ❌ 5 |
17-
| [Grafbase Gateway](https://grafbase.com) | 91.62% | 🟢 164 ❌ 15 | 🟢 36 ❌ 5 |
18-
| [Inigo Gateway](https://inigo.io) | 49.72% | 🟢 89 ❌ 90 | 🟢 12 ❌ 29 |
13+
| [Hive Gateway](https://the-guild.dev/graphql/hive/docs/gateway) | 98.90% | 🟢 179 ❌ 2 | 🟢 41 ❌ 1 |
14+
| [Apollo Router](https://www.apollographql.com/) | 97.79% | 🟢 177 ❌ 4 | 🟢 40 ❌ 2 |
15+
| [Apollo Gateway](https://www.apollographql.com/) | 97.24% | 🟢 176 ❌ 5 | 🟢 39 ❌ 3 |
16+
| [Cosmo Router](https://wundergraph.com) | 95.03% | 🟢 172 ❌ 9 | 🟢 37 ❌ 5 |
17+
| [Grafbase Gateway](https://grafbase.com) | 91.71% | 🟢 166 ❌ 15 | 🟢 37 ❌ 5 |
18+
| [Inigo Gateway](https://inigo.io) | 49.17% | 🟢 89 ❌ 92 | 🟢 12 ❌ 30 |
1919

2020
<!-- gateways:end -->
2121

REPORT.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
| Gateway | Compatibility | Test Cases | Test Suites |
66
| :-------------------------------------------------------------: | :-----------: | :----------: | :---------: |
7-
| [Hive Gateway](https://the-guild.dev/graphql/hive/docs/gateway) | 100.00% | 🟢 179 | 🟢 41 |
8-
| [Apollo Router](https://www.apollographql.com/) | 97.77% | 🟢 175 ❌ 4 | 🟢 39 ❌ 2 |
9-
| [Apollo Gateway](https://www.apollographql.com/) | 97.21% | 🟢 174 ❌ 5 | 🟢 38 ❌ 3 |
10-
| [Cosmo Router](https://wundergraph.com) | 94.97% | 🟢 170 ❌ 9 | 🟢 36 ❌ 5 |
11-
| [Grafbase Gateway](https://grafbase.com) | 91.62% | 🟢 164 ❌ 15 | 🟢 36 ❌ 5 |
12-
| [Inigo Gateway](https://inigo.io) | 49.72% | 🟢 89 ❌ 90 | 🟢 12 ❌ 29 |
7+
| [Hive Gateway](https://the-guild.dev/graphql/hive/docs/gateway) | 98.90% | 🟢 179 ❌ 2 | 🟢 41 ❌ 1 |
8+
| [Apollo Router](https://www.apollographql.com/) | 97.79% | 🟢 177 ❌ 4 | 🟢 40 ❌ 2 |
9+
| [Apollo Gateway](https://www.apollographql.com/) | 97.24% | 🟢 176 ❌ 5 | 🟢 39 ❌ 3 |
10+
| [Cosmo Router](https://wundergraph.com) | 95.03% | 🟢 172 ❌ 9 | 🟢 37 ❌ 5 |
11+
| [Grafbase Gateway](https://grafbase.com) | 91.71% | 🟢 166 ❌ 15 | 🟢 37 ❌ 5 |
12+
| [Inigo Gateway](https://inigo.io) | 49.17% | 🟢 89 ❌ 92 | 🟢 12 ❌ 30 |
1313

1414
## Detailed Results
1515

@@ -80,6 +80,8 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
8080
<pre>🟢🟢</pre>
8181
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
8282
<pre>🟢🟢</pre>
83+
<a href="./src/test-suites/requires-circular">requires-circular</a>
84+
<pre>❌❌</pre>
8385
<a href="./src/test-suites/requires-interface">requires-interface</a>
8486
<pre>🟢🟢🟢🟢🟢</pre>
8587
<a href="./src/test-suites/requires-requires">requires-requires</a>
@@ -173,6 +175,8 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
173175
<pre>🟢🟢</pre>
174176
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
175177
<pre>🟢🟢</pre>
178+
<a href="./src/test-suites/requires-circular">requires-circular</a>
179+
<pre>🟢🟢</pre>
176180
<a href="./src/test-suites/requires-interface">requires-interface</a>
177181
<pre>🟢🟢🟢🟢🟢</pre>
178182
<a href="./src/test-suites/requires-requires">requires-requires</a>
@@ -266,6 +270,8 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
266270
<pre>🟢🟢</pre>
267271
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
268272
<pre>🟢🟢</pre>
273+
<a href="./src/test-suites/requires-circular">requires-circular</a>
274+
<pre>🟢🟢</pre>
269275
<a href="./src/test-suites/requires-interface">requires-interface</a>
270276
<pre>🟢🟢🟢🟢🟢</pre>
271277
<a href="./src/test-suites/requires-requires">requires-requires</a>
@@ -359,6 +365,8 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
359365
<pre>❌❌</pre>
360366
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
361367
<pre>❌❌</pre>
368+
<a href="./src/test-suites/requires-circular">requires-circular</a>
369+
<pre>🟢🟢</pre>
362370
<a href="./src/test-suites/requires-interface">requires-interface</a>
363371
<pre>🟢🟢🟢🟢🟢</pre>
364372
<a href="./src/test-suites/requires-requires">requires-requires</a>
@@ -452,6 +460,8 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
452460
<pre>❌❌</pre>
453461
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
454462
<pre>🟢❌</pre>
463+
<a href="./src/test-suites/requires-circular">requires-circular</a>
464+
<pre>🟢🟢</pre>
455465
<a href="./src/test-suites/requires-interface">requires-interface</a>
456466
<pre>🟢🟢🟢🟢🟢</pre>
457467
<a href="./src/test-suites/requires-requires">requires-requires</a>
@@ -545,6 +555,8 @@ You can look at the full list of tests [here](./src/test-suites/). Every test id
545555
<pre>❌❌</pre>
546556
<a href="./src/test-suites/provides-on-union">provides-on-union</a>
547557
<pre>❌❌</pre>
558+
<a href="./src/test-suites/requires-circular">requires-circular</a>
559+
<pre>❌❌</pre>
548560
<a href="./src/test-suites/requires-interface">requires-interface</a>
549561
<pre>❌❌❌❌❌</pre>
550562
<a href="./src/test-suites/requires-requires">requires-requires</a>

gateways/apollo-gateway/results.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ provides-on-interface
5252
..
5353
provides-on-union
5454
..
55+
requires-circular
56+
..
5557
requires-interface
5658
.....
5759
requires-requires
@@ -82,6 +84,6 @@ union-intersection
8284
........
8385

8486
---
85-
Total: 179
86-
Passed: 174
87+
Total: 181
88+
Passed: 176
8789
Failed: 5

gateways/apollo-router/results.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ provides-on-interface
5252
..
5353
provides-on-union
5454
..
55+
requires-circular
56+
..
5557
requires-interface
5658
.....
5759
requires-requires
@@ -82,6 +84,6 @@ union-intersection
8284
........
8385

8486
---
85-
Total: 179
86-
Passed: 175
87+
Total: 181
88+
Passed: 177
8789
Failed: 4

gateways/cosmo-router/results.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ provides-on-interface
5252
XX
5353
provides-on-union
5454
XX
55+
requires-circular
56+
..
5557
requires-interface
5658
.....
5759
requires-requires
@@ -82,6 +84,6 @@ union-intersection
8284
........
8385

8486
---
85-
Total: 179
86-
Passed: 170
87+
Total: 181
88+
Passed: 172
8789
Failed: 9

gateways/grafbase-gateway/results.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ provides-on-interface
5252
XX
5353
provides-on-union
5454
.X
55+
requires-circular
56+
..
5557
requires-interface
5658
.....
5759
requires-requires
@@ -82,6 +84,6 @@ union-intersection
8284
........
8385

8486
---
85-
Total: 179
86-
Passed: 164
87+
Total: 181
88+
Passed: 166
8789
Failed: 15

gateways/hive-gateway/results.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ provides-on-interface
5252
..
5353
provides-on-union
5454
..
55+
requires-circular
56+
XX
5557
requires-interface
5658
.....
5759
requires-requires
@@ -82,6 +84,6 @@ union-intersection
8284
........
8385

8486
---
85-
Total: 179
87+
Total: 181
8688
Passed: 179
87-
Failed: 0
89+
Failed: 2

gateways/inigo-gateway/results.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ provides-on-interface
5252
XX
5353
provides-on-union
5454
XX
55+
requires-circular
56+
XX
5557
requires-interface
5658
XXXXX
5759
requires-requires
@@ -82,6 +84,6 @@ union-intersection
8284
XXXXXXXX
8385

8486
---
85-
Total: 179
87+
Total: 181
8688
Passed: 89
87-
Failed: 90
89+
Failed: 92

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ async function getTestCases(router: ReturnType<typeof createRouter>) {
4545
import("./test-suites/requires-with-argument/index.js"),
4646
import("./test-suites/keys-mashup/index.js"),
4747
import("./test-suites/null-keys/index.js"),
48+
import("./test-suites/requires-circular/index.js"),
4849
].map((i) => i.then((e) => e.default))
4950
);
5051

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { createSubgraph } from "../../subgraph.js";
2+
import { authors, posts } from "./data.js";
3+
4+
export default createSubgraph("a", {
5+
typeDefs: /* GraphQL */ `
6+
extend schema
7+
@link(
8+
url: "https://specs.apollo.dev/federation/v2.3"
9+
import: ["@key", "@external", "@requires"]
10+
)
11+
12+
type Query {
13+
feed: [Post]
14+
}
15+
16+
type Post @key(fields: "id") {
17+
id: ID!
18+
byNovice: Boolean! @external
19+
byExpert: Boolean! @requires(fields: "byNovice")
20+
}
21+
22+
type Author @key(fields: "id") {
23+
id: ID!
24+
name: String!
25+
yearsOfExperience: Int!
26+
}
27+
`,
28+
resolvers: {
29+
Query: {
30+
feed() {
31+
return posts.map((post) => ({ id: post.id }));
32+
},
33+
},
34+
Post: {
35+
__resolveReference(ref: { id: string; byNovice?: boolean }) {
36+
const post = posts.find((post) => post.id === ref.id);
37+
if (!post) {
38+
return null;
39+
}
40+
if (ref.byNovice == null) {
41+
return {
42+
id: post.id,
43+
};
44+
}
45+
return {
46+
id: post.id,
47+
byNovice: ref.byNovice,
48+
};
49+
},
50+
byExpert(post: { byNovice: boolean }) {
51+
if (post.byNovice == null) {
52+
// ensuring requires is not skipped
53+
return null;
54+
}
55+
return !post.byNovice;
56+
},
57+
},
58+
Author: {
59+
__resolveReference(ref: { id: string }) {
60+
const author = authors.find((author) => author.id === ref.id);
61+
if (!author) {
62+
return null;
63+
}
64+
return {
65+
id: author.id,
66+
name: author.name,
67+
yearsOfExperience: author.yearsOfExperience,
68+
};
69+
},
70+
},
71+
},
72+
});

0 commit comments

Comments
 (0)