2

I'm trying to do a standard GraphQL remote schema merge (which is working fine), but for each of the remote schemas, I'd like to wrap their queries in a top level query once merged for separation.

For instance:

# User Schema
type User {
    id: ID!
    name: String!
}

type Query {
    findById(id: ID!): User
}
# Book Schema
type Book {
    id: ID!
    name: String!
}

type Query {
    findById(id: ID!): Book
}

I would like this to be merged together to form a top level query type of:

type UserQueries {
    findById(id: ID!): User
}

type BookQueries {
    findById(id: ID!): Book
}

type Query {
    UserService: UserQueries
    BookService: BookQueries
}

I'm using the graphql-tools package for the merging and remote schema introspection/creation, but there doesn't seem to be a way of segmenting the merged schemas' queries into separate top-level options. Has anyone done this before, or know of a clean-ish method of accomplishing it?

m_callens
  • 6,100
  • 8
  • 32
  • 54

0 Answers0