Repository navigation
Fix empty filter objects failing with an unexpected error - #10532
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved issues were identified that would block approval.
0 open findings
What changed in this PR
Fixes filter traversal for empty objects and skipped fields so they produce no condition instead of errors across queryable, MongoDB, and spatial providers.
Changes:
- Avoid enqueueing conditions for empty filters.
- Correctly clean up operation/type stacks for skipped fields.
- Add regression tests and update MongoDB error snapshots.
| File | Description |
|---|---|
| src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/QueryableFilterVisitorDistanceTests.cs | Updated as part of this pull request. |
| src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/__snapshots__/QueryableFilterVisitorDistanceTests.ExecuteAsync_Should_ApplyNoCondition_When_DistanceHasNoComparison.snap | Updated as part of this pull request. |
| src/HotChocolate/Spatial/src/Data/Filters/Expressions/Handlers/QueryableSpatialMethodHandler.cs | Updated as part of this pull request. |
| src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterVisitorListTests.cs | Updated as part of this pull request. |
| src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/__snapshots__/MongoDbFilterVisitorListTests.ExecuteAsync_Should_ApplyNoCondition_When_ElementFilterIsEmpty.snap | Updated as part of this pull request. |
| src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/__snapshots__/MongoDbFilterVisitorListTests.Create_ArrayAnyStringEqual_Expression.snap | Updated as part of this pull request. |
| src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/__snapshots__/MongoDbFilterVisitorListTests.Create_ArrayAnyObjectStringEqual_Expression.snap | Updated as part of this pull request. |
| src/HotChocolate/MongoDb/src/Data/Filters/Handlers/List/MongoDbListOperationHandlerBase.cs | Updated as part of this pull request. |
| src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/QueryableFilterVisitorObjectTests.cs | Updated as part of this pull request. |
| src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/QueryableFilterVisitorListTests.cs | Updated as part of this pull request. |
| src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/__snapshots__/QueryableFilterVisitorObjectTests.ExecuteAsync_Should_ApplyNoCondition_When_FieldFilterIsEmpty.snap | Updated as part of this pull request. |
| src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/__snapshots__/QueryableFilterVisitorListTests.ExecuteAsync_Should_ApplyNoCondition_When_ElementFilterIsEmpty.snap | Updated as part of this pull request. |
| src/HotChocolate/Data/src/Data/Filters/Visitor/FilterVisitorBase`2.cs | Updated as part of this pull request. |
| src/HotChocolate/Data/src/Data/Filters/Expressions/Handlers/QueryableDefaultFieldHandler.cs | Updated as part of this pull request. |
| src/HotChocolate/Data/src/Data/Filters/Expressions/Handlers/List/QueryableListOperationHandlerBase.cs | Updated as part of this pull request. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Patch coverage100.0% of changed lines covered (19/19)
Project coverage: 58.7% (315541/537943 lines) |
glen-84
added a commit
that referenced
this pull request
Oct 19, 2026
This was referenced Oct 20, 2026
Merged
This was referenced Oct 26, 2026
Merged
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 21 updates
DFE-Digital/SUI_Matcher#423
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.
Summary
where: { name: { } }), an empty nested object, an emptysome,all, ornoneelement filter, and a spatialdistancewithout a comparison. It matches how an empty top-levelwhere: { }andor: [{ }]already behave, and applies to the queryable provider (in-memory, EF Core, Marten, and Raven), MongoDB, and spatial filtering.nullvalue it reports as an error, the visitor now pops the operation and type it pushed on entering that field, so the parent field is left through its own handler. On MongoDB,all: nullnow reports the HC0026 non-null error the queryable provider already reports, instead of "Unexpected Execution Error".name: { contains: $search }without$searchbecomesname: { }.Test plan
distancewithout a comparison on PostGIS. Each fails with "Unexpected Execution Error" without the fix.all: nullsnapshots now show the HC0026 error.