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?
Really silly solution which took me 4 hours to find.
private class TestResolver
{
public string Get([Parent] My my)
{
return my.Logo;
}
}
Relevant documentation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With