0

I am wondering is there any way of structuring graphql queries/mutations in a GraphiQL ide. Right now I have long list of queries/mutation in docs tab (see image below). What I want is to seperate them by categories (like users, customers, interns etc). Is this possible? or should I use some other tools?

:enter image description here

yerassyl
  • 2,958
  • 6
  • 42
  • 68

2 Answers2

1

GraphQL itself has no concept of namespacing for tools like GraphiQL to take advantage of. You may be able to build your own conventions and tools based on them, but you'll have to do all the legwork.

Andrew Ingram
  • 5,160
  • 2
  • 25
  • 37
1

It may be helpful if you simulate namespace with nested type resolver like following.

type UserQuery {
  users: [User]
  user(id: String): User
}

type InternQuery {
  intern: Intern
  interns: [Intern]
  internCustomers: [Customer]
}

type Query {
  userQuery: UserQuery
  internQuery: InternQuery
}

In your query's resolvers, userQuery and internQuery just need to return empty object, and put your other resolvers into UserQuery and InternQuery.

Yu Huang
  • 3,085
  • 2
  • 24
  • 22