Skip to content

fix: external key field on extended object type#149

Merged
n1ru4l merged 4 commits intomainfrom
test-triage-issue
Jun 27, 2025
Merged

fix: external key field on extended object type#149
n1ru4l merged 4 commits intomainfrom
test-triage-issue

Conversation

@n1ru4l
Copy link
Copy Markdown
Contributor

@n1ru4l n1ru4l commented Jun 12, 2025

No description provided.

@n1ru4l n1ru4l changed the base branch from main to fix-provides-union-type June 12, 2025 11:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jun 12, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@theguild/federation-composition 0.19.1-alpha-20250627095930-55aa97e35a8cca2f27592a378ba4c455b35a097d npm ↗︎ unpkg ↗︎

)

extend type SharedType @key(fields: "id") {
id: ID! @external
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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").

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
  }

@n1ru4l n1ru4l force-pushed the fix-provides-union-type branch from fb6f7d3 to fe7ffff Compare June 17, 2025 08:40
@n1ru4l n1ru4l force-pushed the test-triage-issue branch from 522d255 to 71e8db8 Compare June 17, 2025 09:17
Base automatically changed from fix-provides-union-type to main June 17, 2025 09:27
@n1ru4l n1ru4l force-pushed the test-triage-issue branch from 4abc1db to 519538e Compare June 27, 2025 09:45
@n1ru4l n1ru4l changed the title what is going on here fix: external key field on extended object type Jun 27, 2025
@n1ru4l n1ru4l requested a review from kamilkisiela June 27, 2025 09:59
@n1ru4l n1ru4l marked this pull request as ready for review June 27, 2025 09:59
@n1ru4l n1ru4l merged commit 9ae49e3 into main Jun 27, 2025
4 checks passed
@n1ru4l n1ru4l deleted the test-triage-issue branch June 27, 2025 11:15
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant