fix: external key field on extended object type#149
Merged
Conversation
Contributor
n1ru4l
commented
Jun 12, 2025
| ) | ||
|
|
||
| extend type SharedType @key(fields: "id") { | ||
| id: ID! @external |
Contributor
Author
There was a problem hiding this comment.
This field is only declared here. This passes apollo composition.
However our composition library spits out:
EXTERNAL_MISSING_ON_BASE Field "SharedType.id" is marked @external on all the subgraphs in which it is listed (subgraph "a").
Contributor
Author
There was a problem hiding this comment.
when I combine the SharedType definitions within subgraph a into the following:
type SharedType @key(fields: "id") @key(fields: "secondId") {
id: ID! @external
secondId: ID! @external
dependency: String! @external
someFieldThatRequiresDependency: String @requires(fields: "dependency")
}
I get the following apollo composition error, which is identical to our implementation:
EXTERNAL_MISSING_ON_BASE Field "SharedType.id" is marked @external on all the subgraphs in which it is listed (subgraph "a").
Contributor
Author
There was a problem hiding this comment.
Also the following change will make apollo composition produce an error:
- extend type SharedType @key(fields: "id") {
+ type SharedType @key(fields: "id") {
id: ID! @external
dependency: String! @external
}fb6f7d3 to
fe7ffff
Compare
522d255 to
71e8db8
Compare
4abc1db to
519538e
Compare
n1ru4l
pushed a commit
that referenced
this pull request
Jun 30, 2025
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @theguild/federation-composition@0.19.1 ### Patch Changes - [#149](#149) [`9ae49e3`](9ae49e3) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Fix external key fields on extended object types raising composition errors. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.