I have defined Subgraphs as below and data is fetched from multiple sources
Subgraph A
type Query {
getAllItems(type: String!) : AllItems
}
type AllItems{
type: String
response: QueryResponse
items: [Item!]!
pageInfo: Page
totalCount: Int
}
type Item @key(fields: "id") {
val1: String
val2: String
id: ID!
}
SubgraphB
type Item @key(fields: "id") @extends {
name: String!
id: ID! @external
}
With this approach when getAllItems is called it fetches all items for given type and in subgraph B name is fetched for each item . It is kind of N+1 problem . What I want is
- Either fetch data from subgraphB with list of IDs
- Or I have kind of getAllitemsSubGraphB in SubgraphB but it might give slightly different set (with some extra items).So I want join on "id" field of SubgraphA so that non existing items from SubgraphA will be removed while giving response back
How to achieve it