Input with a __typename field (federated dgraph)

Hello, I’m in the middle of integrating Slash GraphQL into the existing federated graph (Apollo Federation)

To do so, I have added a few required types and lambdas to resolve them

But at moment struggling with the following - for the federation to work we need something like:

scalar _Any
union _Entity = Customer | Product
type Query {
  _entities(representations: [_Any!]!): [_Entity]! @lambda

which will be used like so:

  _entities(representations:[{id:"1",__typename:"Account"}]) {
    ... on Account {

Trying to add such schema got an error complaining that we can not use scalars in the initial schema

Ok, usually almost everywhere we are using something like {id, __typename} as _Any, so I did try:

input _Any {
  id: ID!
  __typename: String!

but immediately got an error complaining that __typename is reserved and can not be added

wondering if there a way to work around this?

Have not tested, but… __typename is autogenerated for types. Not sure about inputs but I assume the same is true. So leave it out and try again?

Indeed typename is autogenerated but without it being added we can not run queries

Support For Apollo Federation seems like this one will solve everything at once

1 Like