1

We have two services exposing two sets of schemas, merged in a gateway using Graphql Tools Schema Stitching

Is it possible to merge queries from two services in such a way that it returns combined results? Example case:

Book service contains data for books

interface Searchable {
 id: ID!
} 

type Book implements Searchable {
  id: ID!
  name: String
  # other fields
}

type Query {
 _search( term: String ): [Searchable]
}

User Service has the data for authors

interface Searchable {
 id: ID!
} 

type Author implements Searchable {
  id: ID!
  name: String
  # other fields
}

type Query {
 _search( term: String ): [Searchable]
}

Gateway


interface Searchable {
 id: ID!
} 

type Book implements Searchable {
  id: ID!
  name: String
  # other fields
}


type Author implements Searchable {
  id: ID!
  name: String
  # other fields
}

type Query {
 search( term: String ): [Searchable]
}
Jimish Fotariya
  • 1,004
  • 8
  • 21

1 Answers1

1

I can recommend using GraphQL-Mesh - it uses tools under the hood, and enables you to easily merge multiple sources (GraphQL and many others), manipulate it and get one GraphQL endpoint / schema

Gil Gardosh
  • 211
  • 1
  • 3
  • Yeah, we are looking into graphql-mesh as a potential rewrite of our gateway. However, I am trying to find out whether It is possible to do so with the basic stitching-merging tools. – Jimish Fotariya Dec 04 '22 at 15:30