Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda