Custom Filter not receiving an argument #6346
Unanswered
KolbeItDeveloper
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm currently in the process of creating a custom equality operator that always returns true on null and executes the base equality behavior if there's a value. I'm currently facing two issues, but i'd like to focus on one for the time being.
I have this class
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using HotChocolate.Data.Filters;
using HotChocolate.Data.Filters.Expressions;
using HotChocolate.Language;
using HotChocolate.Types;
public class QueryableOptionalEqualsHandler : QueryableStringEqualsHandler
{
public QueryableOptionalEqualsHandler(InputParser inputParser) : base(inputParser)
{
}
}
It's registered via startup.cs
.AddFiltering()
.AddConvention(
new FilterConventionExtension(
x => x.AddProviderExtension(
new QueryableFilterProviderExtension(
y => y.AddFieldHandler()
)
)
)
)
alongside this GraphQL where filter
query GetQuotes($email: string){
quotes(where : {
createdBy:
{
eq: $email
}
}
The issue i'm facing however is that my custom equality operation get's a null value when the $email is populated, but hardcoding email: "[email protected]" will pass the value along to the parsedValue parameter.
Is there a better way of going about this?
Beta Was this translation helpful? Give feedback.
All reactions