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

430
Vistas
GraphQL .NET - AutoRegisteringObjectGraphType error on schema loading: Unable to register GraphType

I have a CustomerDetails class:

public record CustomerDetails{
      public string? Code { get; init; }
      public string? Name { get; init; }
      public string? Notes { get; init; }
}

On GraphQL side I have the following:

On queries side:

public class CustomerDetailsGraphType : AutoRegisteringObjectGraphType<CustomerDetails> { }

On mutations side:

public class CustomerDetailsInputGraphType : AutoRegisteringInputObjectGraphType<CustomerDetails> {}

When I run this and try to see the schema into Altair it gives me an error of type:

 "message": "GraphQL.Execution.UnhandledError: Error executing document.\r\n ---> System.InvalidOperationException: Unable to register GraphType 'MyProject.Customers.Mutations.ContactDetailsInputGraphType' with the name 'ContactDetails';\nthe name 'ContactDetails' is already registered to 'MyProject.Customers.Query.ContactDetailsGraphType'.\r\n..."

I don't understand why is that happening?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I found the solution. In both cases, the name of the graph type object will be automatically CustomerDetails. This is not right for the GrapQL schema and cannot be generated. So either in the query or in the mutation you have to specify explicitly a different name in the constructor like this:

public class CustomerDetailsGraphType : AutoRegisteringObjectGraphType<CustomerDetails> 
{
       public CustomerDetailsGraphType()
       {
             Name = "CustomerDetailsGraphType"; // or any other name you consider
       }

}
over 4 years ago · Santiago Trujillo 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