Skip to content

AddQueryType with changed name does not effect types extending ObjectTypeExtension #5389

@anuith

Description

@anuith

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When added server with builder.AddQueryType<QueryType>(d => d.Name("Query")

That name does not have effect on types that extending ObjectTypeExtension<QueryType> and it makes the queries on this type not available on schema.

Steps to reproduce

  1. Create a placeholder class QueryType
public class QueryType { }
  1. In Startup.ConfigureServices() : add AddQueryType<QueryType>(d => d.Name("Query"))
services
  .AddGraphQLServer()
  .AddQueryType<QueryType>(d => d.Name("Query"));
  1. Create a class that extends ObjectTypeExtension<QueryType>
public class HelloQuery : ObjectTypeExtension<QueryType>
{
  protected override void Configure(IObjectTypeDescriptor<QueryType> descriptor)
  {
      // descriptor here has definition name "QueryType" not "Query"
      // and query "hello" will not show on the schema
      descriptor.Field("hello").Resolve("Hello World");
  }
}

Relevant log output

No response

Additional Context?

No response

Product

Hot Chocolate

Version

12.11.11

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions