Repository navigation
fix(filter): support the in operator on a property with HasConversion<string> - #218
Closed
IngbertPalm wants to merge 1 commit into
Closed
IngbertPalm wants to merge 1 commit into
IngbertPalm wants to merge 1 commit into
Conversation
…<string> An array literal such as `Id ^^ ["2","3"]` on a property configured with HasConversion<string>() was handed to the single-value string constructor path, so it could not be used with the in (^^) and not-in (!^^) operators. Build the right side as an array of constants instead, constructing each item with the (string) constructor. Nullable structs, null items, empty lists, and properties with a query name are handled. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #217
Problem
Id ^^ ["2","3"]HasConversion<string>()QueryKitParsingException: the ^^ operator needs a list valueId !^^ ["2","3"]wrappedid ^^ ["1","2"]HasQueryName("wrappedid")Id ^^ ["2","3"]Email ^^ ["b@x.com","c@x.com"]Change
CreateRightExprFromTypeinFilterParserchecks for an array literal on aHasConversion<string>()property before the single-value path.
CreateStringConversionArrayExprbuilds an array of constants andconstructs each item with the
(string)constructor.nullitem staysnull.[]gives an empty array.SplitListItems, so a comma inside a quoted item stays in the item.No public API changes. A single value, such as
Id == "2", takes the same path as before.Tests
QueryKit.UnitTests/HasConversionTests.cs, 6 new tests:^^and!^^on a struct,^^with a query name,a nullable struct (with a
nullrow), a reference type, and a comma inside a quoted item.All 6 fail on
mainwith theQueryKitParsingExceptionabove and pass with the fix.QueryKit.UnitTests: 874 of 874 pass.QueryKit.IntegrationTests(HasConversion, Postgres): 15 of 15 pass.Not covered: a
^^on a converted property against Postgres. The new tests run in memory.🤖 Generated with Claude Code