Skip to content

Conversation

0xTaneja
Copy link
Contributor

@0xTaneja 0xTaneja commented Aug 8, 2025

Disallowing field-level logical operators in filters; only allow them at the root cross-field level. Implements #442.

changes I did :-

removed not and or from EntityFieldFilter<T>.
Root CrossFieldFilter<T> continues to support not/or.
Runtime : reject not/or/and if provided inside a single field filter.
Evaluator: correctly handles nested or and not at the cross-field level with AND semantics for regular fields.
Tests: updated all filter tests to use root-level not/or and added coverage for combined/nested cases.
Lint: cleaned up type-safe access and formatting.

Examples :-

Before:
{ name: { not: { is: "Jane" } } }
{ age: { or: [{ is: 25 }, { is: 40 }] } }

After:
{ not: { name: { is: "Jane" } } }
{ or: [{ age: { is: 25 } }, { age: { is: 40 } }] }

Notes
No server/docs/deploy changes required.
No public GraphQL filter changes in this PR; this strictly tightens local filtering semantics.

Issue
Closes #442

Checklist
[x] Tests added/updated
[x] Types updated
[x] Lint/typecheck/build pass

Copy link
Collaborator

@nikgraf nikgraf left a comment

Choose a reason for hiding this comment

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

nice one, thanks @0xTaneja

@nikgraf nikgraf merged commit 9cc82be into graphprotocol:main Aug 9, 2025
0 of 2 checks 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.

Tighten filter types

2 participants