Skip to content

Commit a3d0304

Browse files
authored
First crack at adding the ability to merge core directives. (#1996)
We can now merge custom core directive with the @mergeDirective directive. - Directive must be a core directive - @mergeDirective exists on schema - major version of merged directive must be the same across all subgraphs
1 parent 3d3a798 commit a3d0304

16 files changed

Lines changed: 1862 additions & 210 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`composing custom core directives custom tag directive works when federation tag is renamed 1`] = `
4+
"schema
5+
@link(url: \\"https://specs.apollo.dev/link/v1.0\\")
6+
@link(url: \\"https://specs.apollo.dev/join/v0.2\\", for: EXECUTION)
7+
@link(url: \\"https://specs.apollo.dev/tag/v0.2\\", as: \\"mytag\\")
8+
@link(url: \\"https://custom.dev/tag/v1.0\\", import: [\\"@tag\\"])
9+
{
10+
query: Query
11+
}
12+
13+
directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA
14+
15+
directive @join__graph(name: String!, url: String!) on ENUM_VALUE
16+
17+
directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR
18+
19+
directive @join__field(graph: join__Graph!, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
20+
21+
directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE
22+
23+
directive @mytag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
24+
25+
directive @tag(name: String!, prop: String!) on FIELD_DEFINITION | OBJECT
26+
27+
enum link__Purpose {
28+
\\"\\"\\"
29+
\`SECURITY\` features provide metadata necessary to securely resolve fields.
30+
\\"\\"\\"
31+
SECURITY
32+
33+
\\"\\"\\"
34+
\`EXECUTION\` features provide metadata necessary for operation execution.
35+
\\"\\"\\"
36+
EXECUTION
37+
}
38+
39+
scalar link__Import
40+
41+
enum join__Graph {
42+
SUBGRAPHA @join__graph(name: \\"subgraphA\\", url: \\"\\")
43+
SUBGRAPHB @join__graph(name: \\"subgraphB\\", url: \\"\\")
44+
}
45+
46+
scalar join__FieldSet
47+
48+
type Query
49+
@join__type(graph: SUBGRAPHA)
50+
@join__type(graph: SUBGRAPHB)
51+
{
52+
a: User @join__field(graph: SUBGRAPHA)
53+
subgraphB: User @join__field(graph: SUBGRAPHB)
54+
}
55+
56+
type User
57+
@join__type(graph: SUBGRAPHA, key: \\"id\\")
58+
@join__type(graph: SUBGRAPHB, key: \\"id\\")
59+
{
60+
id: Int
61+
a: String @tag(name: \\"a\\", prop: \\"b\\") @join__field(graph: SUBGRAPHA)
62+
b: String @mytag(name: \\"c\\") @join__field(graph: SUBGRAPHA)
63+
subgraphB: String @join__field(graph: SUBGRAPHB)
64+
}"
65+
`;

0 commit comments

Comments
 (0)