graphql-platform
graphql-platform copied to clipboard
AddQueryType with changed name does not effect types extending ObjectTypeExtension
Is there an existing issue for this?
- [x] 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
- Create a placeholder class
QueryType
public class QueryType { }
- In
Startup.ConfigureServices()
: addAddQueryType<QueryType>(d => d.Name("Query"))
services
.AddGraphQLServer()
.AddQueryType<QueryType>(d => d.Name("Query"));
- 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
A way to avoid is to not change the name of QueryType
descriptor or add descriptor.Name("Query")
in every classes that extends ObjectTypeExtension<QueryType>