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

429
Views
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 answers
Answer question

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 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!