Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
How to group GraphQL query objects into namespaces?

How can I group my queries into namespaces in GraphQL? I have something like this right now:

const queryType = new g.GraphQLObjectType({
    name: "Query",
    fields: fields,
});

and in fields I have field -> object mappings and it works fine, but I'd like to group these mappings into two groups (live and historical). If I modify the above code to this however:

const queryType = new g.GraphQLObjectType({
    name: "Query",
    fields: {
        historical: {
            type: new g.GraphQLObjectType({
                name: "historical",
                fields: fields,
            })
        }
    },
});

everything resolves to null. How can I write a resolver for this grouping? Is it possible at all?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

so often people want namespaces for the sake of splitting up code, not sure if this is your end goal but you could achieve that this way aswell:

# in one file
type Mutation {
    login(username: String, password: String): User
}

# in other file
extend type Mutation {
    postX(title: String, message: String): X
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!