I'm using HotChocolate 12.0.1. I have following type definition:
public class MyType : ObjectType<My>
{
protected override void Configure(IObjectTypeDescriptor<My> descriptor)
{
descriptor.Field(p => p.Name)
.ResolveWith<TestResolver>(r => r.Get(default))
.Type<IdType>();
descriptor.Field(p => p.Logo)
.Type<StringType>();
}
private class TestResolver
{
public string Get(My my)
{
return my.Logo;
}
}
}
I expect injection of My object in TestResolver Get(My my) after it is populated with Logo value, as I've seen in example: https://github.com/ChilliCream/graphql-workshop/blob/master/docs/3-understanding-dataLoader.md
But for some reason, I've got from HotChocolate parameter lookup:
There was no argument with the name `my` found on the field `name`.
My query:
query {
my(someId: 123) {
name
logo
}
}
Startup:
services.AddGraphQLServer()
.AddQueryType<QueryType>()
.AddType<MyType>()
Where could be the problem?
CodePudding user response:
Really silly solution which took me 4 hours to find.
private class TestResolver
{
public string Get([Parent] My my)
{
return my.Logo;
}
}
Relevant documentation: