You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/api/apollo-federation.mdx
+5-4
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,14 @@ api_reference: true
7
7
8
8
This API reference documents the exports from the `@apollo/federation` package.
9
9
10
-
## `buildFederatedSchema`
10
+
## `buildSubgraphSchema`
11
+
> This method was renamed from `buildFederatedSchema` after @apollo/federation v0.28.0 (the previous name still works but might be removed in a future release).
11
12
12
13
A function that takes an array of GraphQL schema modules and returns a federation-ready schema based on those modules:
The name of a special **reference resolver** function you can define for every [entity](../entities/) in a resolver map, _if_ that resolver map is part of a [federated schema](#buildfederatedschema).
93
+
The name of a special **reference resolver** function you can define for every [entity](../entities/) in a resolver map, _if_ that resolver map is part of a [subgraph schema](#buildSubgraphSchema).
93
94
94
95
The `__resolveReference` function enables your gateway's query planner to resolve a particular entity by whatever unique identifier your other subgraphs use to reference it. For details, see [Entities: Resolving](../entities/#resolving).
(As shown, you now pass your `typeDefs` and `resolvers` to `buildFederatedSchema`.)
42
+
(As shown, you now pass your `typeDefs` and `resolvers` to `buildSubgraphSchema`.)
43
43
44
44
And that's it! You can now perform all of the same subgraph setup on your _own_ service (introspection, schema registration, etc.) that you did with the Apollo-hosted services we used in the first two parts. Refer to those parts for guidance.
Finally, we use the `buildFederatedSchema` function from the `@apollo/federation` package to augment our schema definition with federation support. We provide the result of this function to the `ApolloServer` constructor:
104
+
Finally, we use the `buildSubgraphSchema` function from the `@apollo/federation` package to augment our schema definition with federation support. We provide the result of this function to the `ApolloServer` constructor:
Copy file name to clipboardExpand all lines: federation-js/CHANGELOG.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@
4
4
5
5
> The changes noted within this `vNEXT` section have not been released yet. New PRs and commits which introduce changes should include an entry in this `vNEXT` section as part of their development. When a release is being prepared, a new header will be (manually) created below and the appropriate changes within that release will be moved into the new section.
6
6
7
-
-_Nothing yet! Stay tuned_.
7
+
- Rename `buildFederatedSchema` to `buildSubgraphSchema`. The previous name will continue to be supported but is deprecated. No functional change, usages of `buildFederatedSchema` should just be replaced with `buildSubgraphSchema`. [PR #915](https://github.com/apollographql/federation/pull/913)
8
8
9
9
## v0.28.0
10
10
11
-
- When resolving the `Query._entities` field, honor `@cacheControl` directives on the object types that are members of the `_Entity` union. This feature is only enabled when your subgraph is running Apollo Server 3.0.2 or later. [PR #870](https://github.com/apollographql/apollo-server/pull/870)[Related docs PR](https://github.com/apollographql/apollo-server/pull/5536)
11
+
- When resolving the `Query._entities` field, honor `@cacheControl` directives on the object types that are members of the `_Entity` union. This feature is only enabled when your subgraph is running Apollo Server 3.0.2 or later. [PR #870](https://github.com/apollographql/federation/pull/870)[Related docs PR](https://github.com/apollographql/apollo-server/pull/5536)
it(`should mark a type with a key field as an entity`,()=>{
15
-
constschema=buildFederatedSchema(gql`
15
+
constschema=buildSubgraphSchema(gql`
16
16
type Product @key(fields: "upc") {
17
17
upc: String!
18
18
name: String
@@ -34,7 +34,7 @@ type Product {
34
34
});
35
35
36
36
it(`should mark a type with multiple key fields as an entity`,()=>{
37
-
constschema=buildFederatedSchema(gql`
37
+
constschema=buildSubgraphSchema(gql`
38
38
type Product @key(fields: "upc") @key(fields: "sku") {
39
39
upc: String!
40
40
sku: String!
@@ -58,7 +58,7 @@ type Product {
58
58
});
59
59
60
60
it(`should not mark a type without a key field as an entity`,()=>{
61
-
constschema=buildFederatedSchema(gql`
61
+
constschema=buildSubgraphSchema(gql`
62
62
type Money {
63
63
amount: Int!
64
64
currencyCode: String!
@@ -79,7 +79,7 @@ type Money {
79
79
sdl
80
80
}
81
81
}`;
82
-
constschema=buildFederatedSchema(gql`
82
+
constschema=buildSubgraphSchema(gql`
83
83
"A user. This user is very complicated and requires so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so so much description text"
84
84
type User @key(fields: "id") {
85
85
"""
@@ -130,7 +130,7 @@ type User @key(fields: "id") {
130
130
131
131
describe(`should add an _entities query root field to the schema`,()=>{
132
132
it(`when a query root type with the default name has been defined`,()=>{
133
-
constschema=buildFederatedSchema(gql`
133
+
constschema=buildSubgraphSchema(gql`
134
134
type Query {
135
135
rootField: String
136
136
}
@@ -149,7 +149,7 @@ type Query {
149
149
});
150
150
151
151
it(`when a query root type with a non-default name has been defined`,()=>{
152
-
constschema=buildFederatedSchema(gql`
152
+
constschema=buildSubgraphSchema(gql`
153
153
schema {
154
154
query: QueryRoot
155
155
}
@@ -173,7 +173,7 @@ type QueryRoot {
173
173
});
174
174
describe(`should not add an _entities query root field to the schema`,()=>{
175
175
it(`when no query root type has been defined`,()=>{
0 commit comments