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 $"{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
fullName does 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
}
}