fix(filter)!: ignore a fully prevented clause by its query name - #152
Merged
Merged
Conversation
pdevito3
force-pushed
the
fm/qk-breaking-prevented-query-name
branch
from
October 1, 2026 21:40
694f31e to
eaf0d0e
Compare
v1.14.2 and main throw InvalidOperationException when a filter uses the query name of a property with PreventFilter and PreventSort. The member name of the same property gives an ignored clause. The alias rewrite pass no longer throws, so the query name gives the same ignored clause as the member name. BREAKING CHANGE: a filter clause on the query name of a property with PreventFilter and PreventSort no longer throws InvalidOperationException. IgnoredClauseBehavior controls the clause, like for the member name. QueryKitPropertyMappings.ReplaceAliasesWithPropertyPaths no longer throws for this query name.
pdevito3
force-pushed
the
fm/qk-breaking-prevented-query-name
branch
from
October 3, 2026 11:57
eaf0d0e to
16349da
Compare
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.
Summary
QueryKitPropertyMappings.ReplaceAliasesWithPropertyPathsno longer throwsInvalidOperationExceptionfor the query name of a property withPreventFilter()andPreventSort(). It replaces the query name like any other query name.ParseFilter. A filter that uses the query name of a fully prevented property removes the clause (or replaces it withtrue == true), like any prevented property.v1.14.2 behavior
With
HasQueryName("name").PreventFilter().PreventSort()onTitle:name == "x" || Age > 100InvalidOperationException: 'Title' is not allowed for filtering or sorting.x => (x.Age > 100)Title == "name == x"(query namenameonFirstName)InvalidOperationException, because the regex matched text inside the quoted valuex => (x.Title == "name == x")ReplaceAliasesWithPropertyPaths("name == \"x\"")InvalidOperationExceptionTitle == "x"Justification
A prevented property must act the same way in every form: the clause is ignored by
IgnoredClauseBehavior. The throw applied only when both settings were on, only in front of an operator, and also inside quoted values.Migration
If a client caught
InvalidOperationExceptionfor this case, it now gets the result of the other clauses.Tests
PropertyResolverTests:query_name_of_a_property_prevented_for_filter_and_sort_in_a_quoted_value_is_not_changedandalias_replacement_does_not_throw_for_a_property_prevented_for_filter_and_sort.prevented_property_clause_by_its_query_name_under_or_does_not_return_every_row.dotnet test: 529 unit tests and 325 Postgres integration tests pass.