0
I have an ItemType defined with some custom fields that are resolved with ResolveWith
:
public class ItemType : ObjectType<Item> { protected override void Configure(IObjectTypeDescriptor<FilterTreeItem> descriptor) { descriptor .Field("fullName") .Type<StringType>() .ResolveWith<Resolver>(r => r.GetFullName(default!)); // Other properties } private class Resolver { public async Task<string> GetFullName([Parent] Item? parent, CancellationToken cancellationToken = default) { return
quot;{parent.FirstName} {parent.LastName}";
}
}
}
And I have a query with[UseSorting]
defined:[UseFiltering] [UseSorting] public async Task<IEnumerable<Item>> GetItems( int age, CancellationToken cancellationToken = default ) { // return items; }
Now when I want to sort my GraphQL response by fullName using the query, I get an error saying that
The specified input object field
fullNamedoes not exist.
. Is there a proper workaround for it? I’ve seen a similar issue on Github (link) but from what I understood, that has been solved in HotChocolate 13+. This is what my query looks like. Am I doing something wrong?query GetItems($age: Number!) { items( age: $age, order: [{ fullName: ASC }] ) { id fullName } }
Reset to default
Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.
Browse other questions tagged
or ask your own question.
or ask your own question.
|