Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow users to extend federation types #1717

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

obmarg
Copy link
Member

@obmarg obmarg commented May 14, 2024

I was helping Fredrik setup for a sales demo last week, and we ran into some problems with the fairly common pattern of extending types from another subgraph:

extend type Whatever @key(fields: "id") {
  id: String,
  someField: String @join(...)
}
  1. It would complain that id didn't have a join or custom resolver on it.
  2. It'd complain that Whatever didn't exist for extension.

It's quite easy to work around this by removing the extend keyword, but we should probably be friendlier to users and just let them do this.

Fixes GB-6682
Fixes GB-6678

@obmarg obmarg requested a review from a team as a code owner May 14, 2024 15:38
@obmarg obmarg requested a review from tomhoule May 14, 2024 15:38
Copy link
Contributor

@tomhoule tomhoule left a comment

Choose a reason for hiding this comment

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

Neat!

engine/crates/parser-sdl/src/validations.rs Outdated Show resolved Hide resolved
I was helping Fredrik setup for a sales demo last week, and we ran into some
problems with the fairly common pattern of extending types from another subgraph:

```graphql
extend type Whatever @key(fields: "id") {
  id: String,
  someField: String @join(...)
}
```

1. It would complain that `id` didn't have a join or custom resolver on it.
2. It'd complain that `Whatever` didn't exist for extension.

It's quite easy to work around this by removing the `extend` keyword, but we
should probably be friendlier to users and just let them do this.
@obmarg obmarg merged commit 725e591 into main May 14, 2024
21 checks passed
@obmarg obmarg deleted the obmarg-push-wqkqxunuvxnw branch May 14, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants