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

Alias fails on federation if the type is declared in multiple nodes #31

Open
codeflyer opened this issue Feb 28, 2022 · 0 comments
Open

Comments

@codeflyer
Copy link
Collaborator

codeflyer commented Feb 28, 2022

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

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 a pull request may close this issue.

1 participant