|
| 1 | +import { normalizeSupergraph } from 'testkit/graphql'; |
1 | 2 | import { getServiceHost } from 'testkit/utils'; |
2 | 3 | import type { SchemaBuilderApi } from '@hive/schema'; |
3 | 4 | import { createTRPCProxyClient, httpLink } from '@trpc/client'; |
@@ -71,96 +72,55 @@ describe('schema service can process metadata', async () => { |
71 | 72 | }); |
72 | 73 |
|
73 | 74 | test('@meta does not need to be in supergraph', () => { |
74 | | - expect(result.supergraph).toMatchInlineSnapshot(` |
75 | | - schema |
76 | | - @link(url: "https://specs.apollo.dev/link/v1.0") |
77 | | - @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) |
78 | | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - @link(url: "https://specs.graphql-hive.com/hive/v1.0", import: ["@meta"]) |
84 | | - { |
85 | | - query: Query |
86 | | - |
87 | | - |
88 | | - } |
89 | | -
|
90 | | -
|
91 | | - directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE |
92 | | -
|
93 | | - directive @join__field( |
94 | | - graph: join__Graph |
95 | | - requires: join__FieldSet |
96 | | - provides: join__FieldSet |
97 | | - type: String |
98 | | - external: Boolean |
99 | | - override: String |
100 | | - usedOverridden: Boolean |
101 | | - ) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION |
102 | | -
|
103 | | - directive @join__graph(name: String!, url: String!) on ENUM_VALUE |
104 | | -
|
105 | | - directive @join__implements( |
106 | | - graph: join__Graph! |
107 | | - interface: String! |
108 | | - ) repeatable on OBJECT | INTERFACE |
109 | | -
|
110 | | - directive @join__type( |
111 | | - graph: join__Graph! |
112 | | - key: join__FieldSet |
113 | | - extension: Boolean! = false |
114 | | - resolvable: Boolean! = true |
115 | | - isInterfaceObject: Boolean! = false |
116 | | - ) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR |
117 | | -
|
118 | | - directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION |
119 | | -
|
120 | | - scalar join__FieldSet |
121 | | -
|
122 | | -
|
123 | | - directive @link( |
124 | | - url: String |
125 | | - as: String |
126 | | - for: link__Purpose |
127 | | - import: [link__Import] |
128 | | - ) repeatable on SCHEMA |
129 | | -
|
130 | | - scalar link__Import |
131 | | -
|
132 | | - enum link__Purpose { |
133 | | - """ |
134 | | - \`SECURITY\` features provide metadata necessary to securely resolve fields. |
135 | | - """ |
136 | | - SECURITY |
137 | | -
|
138 | | - """ |
139 | | - \`EXECUTION\` features provide metadata necessary for operation execution. |
140 | | - """ |
141 | | - EXECUTION |
142 | | - } |
| 75 | + expect(result.supergraph).toBeDefined(); |
| 76 | + expect(normalizeSupergraph(result.supergraph!)).toMatchInlineSnapshot(` |
| 77 | + directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE |
143 | 78 |
|
| 79 | + 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 |
144 | 80 |
|
| 81 | + directive @join__graph(name: String!, url: String!) on ENUM_VALUE |
145 | 82 |
|
| 83 | + directive @join__implements(graph: join__Graph!, interface: String!) repeatable on INTERFACE | OBJECT |
146 | 84 |
|
| 85 | + directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true, isInterfaceObject: Boolean! = false) repeatable on ENUM | INPUT_OBJECT | INTERFACE | OBJECT | SCALAR | UNION |
147 | 86 |
|
| 87 | + directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION |
148 | 88 |
|
| 89 | + directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA |
149 | 90 |
|
150 | 91 | enum join__Graph { |
151 | | - FOO_GRAPHQL @join__graph(name: "foo.graphql", url: "") |
152 | | - USER_GRAPHQL @join__graph(name: "user.graphql", url: "") |
| 92 | + FOO_GRAPHQL @join__graph(name: "foo.graphql", url: "") |
| 93 | + USER_GRAPHQL @join__graph(name: "user.graphql", url: "") |
| 94 | + } |
| 95 | +
|
| 96 | + enum link__Purpose { |
| 97 | + """ |
| 98 | + \`EXECUTION\` features provide metadata necessary for operation execution. |
| 99 | + """ |
| 100 | + EXECUTION |
| 101 | + """ |
| 102 | + \`SECURITY\` features provide metadata necessary to securely resolve fields. |
| 103 | + """ |
| 104 | + SECURITY |
153 | 105 | } |
154 | 106 |
|
155 | | - type Query @join__type(graph: FOO_GRAPHQL) @join__type(graph: USER_GRAPHQL) { |
156 | | - foo: String @join__field(graph: FOO_GRAPHQL) |
157 | | - user: User @join__field(graph: USER_GRAPHQL) |
| 107 | + type Query @join__type(graph: FOO_GRAPHQL) @join__type(graph: USER_GRAPHQL) { |
| 108 | + foo: String @join__field(graph: FOO_GRAPHQL) |
| 109 | + user: User @join__field(graph: USER_GRAPHQL) |
158 | 110 | } |
159 | 111 |
|
160 | | - type User @join__type(graph: USER_GRAPHQL) { |
| 112 | + type User @join__type(graph: USER_GRAPHQL) { |
161 | 113 | id: ID! |
162 | 114 | name: String |
163 | 115 | } |
| 116 | +
|
| 117 | + scalar join__FieldSet |
| 118 | +
|
| 119 | + scalar link__Import |
| 120 | +
|
| 121 | + schema @link(for: EXECUTION, url: "https://specs.apollo.dev/join/v0.3") @link(import: ["@meta"], url: "https://specs.graphql-hive.com/hive/v1.0") @link(url: "https://specs.apollo.dev/link/v1.0") { |
| 122 | + query: Query |
| 123 | + } |
164 | 124 | `); |
165 | 125 | }); |
166 | 126 |
|
|
0 commit comments