Repository navigation
fix(filter): read a list for the in operators on a HasConversion<string> property - #220
Merged
Merged
Conversation
…<string> The tests read a list with ^^ and !^^ on a struct, a nullable struct, and a reference type that has a (string) constructor. They fail with the QueryKitParsingException from #217.
…ng> property A list such as Id ^^ ["2","3"] went to the single-value (string) constructor path, so ^^ and !^^ threw QueryKitParsingException. Now each list item goes through the (string) constructor and the right side is an array of constants. A list item that does not convert throws ParsingException with the value and the property name. Fixes #217
Owner
Author
|
Review gate note. One low finding stays open: |
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.
Why
The in operators
^^and!^^threwQueryKitParsingExceptionon a property that is configured withHasConversion<string>(). QueryKit sent the list to the single-value(string)constructor path. Now QueryKit converts each list item with the(string)constructor.Closes #217
What changed
HasConversion<string>()property, QueryKit now builds an array of constants. It uses the same list check, item split, and value conversion as other types.ParsingExceptionwith the value, the property name, and the type.Scope
"null"is the textnull, the same as in a string list.Tradeoffs
This replaces #218. That PR built its own bracket check and its own item parsing. As a result,
Email == "[a]"failed, edge quotes were removed from list items, and"null"became a null.Blast Radius
The change runs only for a list on a
HasConversion<string>()property with a(string)constructor. Before, that input always threw. With other operators, a value in brackets, such asEmail == [a]orEmail == "[a]", is still one value, and a test guards it.Verification
QueryKit.IntegrationTestsagainst Postgres:Email ^^ [...]givesWHERE p.email IN (...)with the correct rows. Before the fix, it threw the error from The in operator (^^,!^^) does not work on a property with HasConversion<string> #217. 396 of 396 pass.QueryKit.UnitTests: 880 of 880 pass. The 10 new list tests failed before the fix.