Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

431
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda