Skip to content

Treat empty _in arrays as false, ie.#86

Merged
rvanoord merged 4 commits intomainfrom
change/allow-empty-in-arrays
Aug 25, 2025
Merged

Treat empty _in arrays as false, ie.#86
rvanoord merged 4 commits intomainfrom
change/allow-empty-in-arrays

Conversation

@u12206050
Copy link
Member

Don't throw error if filter contains empty array on _in and _nin operators. Simply treat them as arrays that don't contain any values ie. false.

@u12206050 u12206050 requested review from Copilot and rvanoord August 22, 2025 21:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR modifies the filter parsing logic to treat empty arrays in _in and _nin operators as valid values rather than throwing an exception. The change allows empty arrays to function as intended: _in with an empty array matches no items (always false), and _nin with an empty array matches all items (always true).

  • Removes the exception thrown when arrays are empty for _in and _nin operators
  • Updates tests to verify the new behavior instead of expecting exceptions
  • Adds comprehensive test coverage for both empty _in and _nin scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/BccCode.Linq/Server/Filter.cs Modified array validation to allow empty arrays and added null safety check for tuple creation
tests/BccCode.Linq.Tests/FilterTests.cs Updated test to verify empty arrays are now allowed instead of throwing exceptions
tests/BccCode.Linq.Tests/Server/FilterToLambdaParserTests.cs Added new tests for _in, empty _in, and empty _nin operator behaviors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ice1e0
Copy link

ice1e0 commented Aug 23, 2025

@u12206050 Great catch! I think this should be implemented, giving the library more optimistic behavior. @rvanoord pls review

@rvanoord rvanoord merged commit 1b7facb into main Aug 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants