mercurius-gateway
mercurius-gateway copied to clipboard
Alias fails on federation if the type is declared in multiple nodes
Hi, I'm facing this issue: when a query uses an alias of a type declared in multiple nodes returns null.
Schema Node 1:
extend type Query {
list: PageInfo
}
type User @key(fields: "id") {
id: ID!
name: String
}
type PageInfo {
edges: [User]
}
Schema Node 2:
type PageInfo {
edges: [User]
}
type User @key(fields: "id") @extends {
id: ID! @external
}
The query used without an alias:
{
list { edges {id name}}
}
return the data:
{ data: { list: { edges: [{id: 1, ....] } } }
Calling instead
{
list { items: edges {id name}}
}
returns
{ data: { list: { items: null } } }
The erro occur only if the type PageInfo
is required multiple times.
If the PageInfo
declaration is removed from the second node, everything works fine.
I've recreated the error in this test: https://github.com/mercurius-js/mercurius/pull/744/files