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

Filtering for null/empty case insensitive #171

Open
brendonparker opened this issue Jun 6, 2024 · 3 comments · Fixed by #175
Open

Filtering for null/empty case insensitive #171

brendonparker opened this issue Jun 6, 2024 · 3 comments · Fixed by #175
Labels
bug Something isn't working

Comments

@brendonparker
Copy link

Version

2.14.1

Details

Thanks for this great library! It really is awesome!

When I attempt to submit a filter like: name=/i an exception is thrown:

Gridify.GridifyFilteringException: 'Unexpected token at index 7, expected '

I'm using gridify-client on the front-end to construct the filter.

I can (and have) changed my code around this to prevent this state/combination of CI + Empty. But seems this could be better handled either by the Gridify code or gridify-client code.

IMO the case-insensitive (/i) should just be ignored in this scenario, and no exception should be thrown.

Steps to reproduce

Failing test (throws an exception):

[Fact] // issue #??
public void ApplyFiltering_CaseInsensitiveEmptyFields_ShouldFilter()
{
   var actual = _fakeRepository.AsQueryable().ApplyFiltering("name=/i").ToList();
   var expected = _fakeRepository.Where(q => string.IsNullOrEmpty(q.Name)).ToList();

   Assert.Equal(expected.Count, actual.Count);
   Assert.Equal(expected, actual);
   Assert.True(actual.Any());
}
@brendonparker brendonparker added the bug Something isn't working label Jun 6, 2024
@alirezanet
Copy link
Owner

Hello @brendonparker,
Thank you for the positive feedback regarding the library. I'm pleased to know you find it beneficial.
Great catch! I will aim to resolve this issue in the upcoming version.

@hershi9
Copy link
Contributor

hershi9 commented Aug 6, 2024

@alirezanet Thank you for this great library, it's really awesome!
It appears that the use of parentheses, for instance, ?filter=address=ad/i,(room=/i|category=*/i) throws a Gridify.GridifyFilteringException: Unexpected token CaseInsensitive at index 23, expected CloseParenthesis error.
Is this a bug or an expected behaviour?

@alirezanet

This comment was marked as outdated.

@alirezanet alirezanet reopened this Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants