Skip to content

Commit

Permalink
fixed nested projections of filtering and sorting (#2633)
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn committed Nov 21, 2020
1 parent 87bcb17 commit 770c35d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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
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
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

0 comments on commit 770c35d

Please sign in to comment.