-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly generate a federated schema when no entity has a
@key
.
Normally, when a service is taking part in graphql federation, it will have at least one type defined with a `@key` field, so that other services can link to (that is, have an edge pointing to) the type that this service provides. The previous federation code assumed that was the case. But it's not required: a service could not define `@key` on any of its types. It might seem that would mean the service is unreachable, since there is no possibility of edges into the service, but there are two edges that can exist even without a `@key`: top level Query edges and top level Mutation edges. That is, if a service only provides a top-level query or top-level mutation, it might not need to define a `@key`. This commit updates the federation code to support that use case.
- Loading branch information
Showing
6 changed files
with
95 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type Hello { | ||
name: String! | ||
} | ||
|
||
type Query { | ||
hello: Hello! | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
schema: | ||
- "test_data/nokey.graphql" | ||
federated: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
type Hello @key(fields: "name") { | ||
name: String! | ||
} | ||
type Query { | ||
hello: Hello! | ||
} | ||
name: String! | ||
} | ||
|
||
type Query { | ||
hello: Hello! | ||
} |