Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nested projections of filtering and sorting #2633

Merged
merged 2 commits into from
Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using HotChocolate.Data.Projections.Expressions;
using HotChocolate.Data.Projections.Expressions.Handlers;
using HotChocolate.Execution.Processing;
using HotChocolate.Language;
using HotChocolate.Types;
using static HotChocolate.Data.ErrorHelper;
using static HotChocolate.Data.Filters.Expressions.QueryableFilterProvider;
Expand Down Expand Up @@ -40,7 +41,8 @@ public class QueryableFilterInterceptor
out IReadOnlyDictionary<NameString, ArgumentValue>? coercedArgs) &&
coercedArgs.TryGetValue(argumentName, out var argumentValue) &&
argumentValue.Argument.Type is IFilterInputType filterInputType &&
argumentValue.ValueLiteral is {} valueNode)
argumentValue.ValueLiteral is {} valueNode &&
valueNode is not NullValueNode)
{
QueryableFilterContext filterContext =
argumentVisitor(valueNode, filterInputType, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using HotChocolate.Data.Sorting;
using HotChocolate.Data.Sorting.Expressions;
using HotChocolate.Execution.Processing;
using HotChocolate.Language;
using HotChocolate.Types;
using static HotChocolate.Data.ErrorHelper;
using static HotChocolate.Data.Sorting.Expressions.QueryableSortProvider;
Expand Down Expand Up @@ -41,7 +42,8 @@ public class QueryableSortInterceptor
argumentValue.Argument.Type is ListType lt &&
lt.ElementType is NonNullType nn &&
nn.NamedType() is ISortInputType sortInputType &&
argumentValue.ValueLiteral is {} valueNode)
argumentValue.ValueLiteral is {} valueNode &&
valueNode is not NullValueNode)
{
QueryableSortContext sortContext =
argumentVisitor(valueNode, sortInputType, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ protected override ISyntaxVisitorAction Enter(IValueNode node, TContext context)
{
base.Enter(node, context);

if (context.Fields.Peek() is ISortField field &&
if (node is not NullValueNode &&
context.Fields.Peek() is ISortField field &&
field.Type is SortEnumType sortType &&
node is EnumValueNode enumValueNode)
{
Expand Down