-
Notifications
You must be signed in to change notification settings - Fork 2k
Why does the gateway expand interface fragment into multiple implementations fragments? (federation) #3253
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
Comments
Ok, I think I can answer the question myself. We should do it because we don't want to define all interfaces in every service. |
@vitramir my apologies for not responding to your question. This is actually a bug within query planner that we'll be working to fix. The query is fine, and the query planner should just remove the type condition |
@trevor-scheer Check my PR, please. |
My team found one more case. Interface inside interface. interface Item{
id: ID!
content: Content
}
enum ContentType{
text
number
}
interface Content{
type: ContentType
}
type Text implements Content{
type: ContentType
value: String
}
type Number implements Content{
type: ContentType
value: Int
}
type Brand implements Item{
id: ID!
content: Text!
}
type Department implements Item{
id: ID!
content: Number!
}
type Query{
item: Item
} Then query {
item {
content {
type
}
}
} will be transformed into Fetch(service: "data") {
{
item {
... on Brand {
content {
... on Text {
type
}
... on Number {
type
}
}
}
... on Department {
content {
... on Text {
type
}
... on Number {
type
}
}
}
}
} But Department's content can't be of type Text and Brand's content can't be of type Number |
Looks like I have fixed this in last commit |
Great @vitramir I also noticed this today at work 😄 |
I don't follow this conversation - is this still a TODO @trevor-scheer? |
For me bumping to the latest version solved my issues. |
@vitramir Ah ok, my bad, got confused thinking there was an app-specific fix. The PR makes sense and fixes the problem in our use case. |
For example we have SDL with interface and multiple implementations:
Then query
will be transformed into
So, the result will be error "Fragment cannot be spread here as objects of type "Brand" can never be of type "Department"."
Why don't we pass fragments as is?
The text was updated successfully, but these errors were encountered: