movio / bramble

A federated GraphQL API gateway
https://movio.github.io/bramble/
MIT License
497 stars 55 forks source link

Union of @boundary Types #136

Closed pasdeloup closed 2 years ago

pasdeloup commented 2 years ago

I can't find details about Union support: neither documented nor reported as unsupported. But I can't make it work:

Graph1

type Album @boundary {
  id: ID!
}

type Artist @boundary {
  id: ID!
}

union CatalogEntity = Album | Artist

type FeedCard {
  type: String!
  catalogEntity: CatalogEntity
}

type Query {
  (...)
  feed: [FeedCard]
}

Graph2

type Album @boundary {
  id: ID!
  title: String!
}

type Artist @boundary {
  id: ID!
  name: String!
}

When I query with

feed {
    type
    catalogEntity {
      __typename      
      ... on Artist {
        id
        name
      }     
      ... on Album {
        id
        title
      }

    }
  }
}

I receive

"message": "Cannot query field \"title\" on type \"Artist\"".

Did I miss something? maybe declare the Union in graph 2 but how?

lucianjon commented 2 years ago

Hi @pasdeloup, at this stage we don't support @boundary on union types. It is a little hidden but mentioned here

pasdeloup commented 2 years ago

Thanks @lucianjon , sorry I really missed that FAQ indeed!