Standardize filter syntax to MongoDB-style and complete documentation#53
Standardize filter syntax to MongoDB-style and complete documentation#53
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… guide Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ters Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot fix build |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request standardizes filter syntax across the ObjectStack spec from array-based filters to MongoDB-style FilterCondition objects. The change affects dashboard widgets, reports, and client SDK examples, providing a more intuitive and type-safe querying interface.
Changes:
- Replaced old
filter + filterItemsstructure in Reports with a singlefilter: FilterConditionSchema - Updated Dashboard widgets to use FilterConditionSchema instead of
z.any() - Migrated all examples (dashboards, reports, client tests) from array-based syntax
[['field', '=', 'value']]to MongoDB-style{ field: value }or{ field: { $op: value } }
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/spec/src/ui/report.zod.ts | Replaced filter/filterItems with single FilterConditionSchema |
| packages/spec/src/ui/dashboard.zod.ts | Changed filter from z.any() to FilterConditionSchema |
| packages/spec/src/ui/dashboard.test.ts | Updated all 14 test filters to MongoDB-style syntax |
| packages/spec/json-schema/Report.json | Generated JSON schema for new FilterCondition structure |
| packages/spec/json-schema/DashboardWidget.json | Generated JSON schema with FilterCondition allOf pattern |
| packages/spec/json-schema/Dashboard.json | Generated JSON schema with FilterCondition allOf pattern |
| examples/todo/src/client-test.ts | Updated client example to use MongoDB-style filters with 'filters' property |
| examples/crm/src/ui/reports.ts | Converted 6 report filters from old filterItems to FilterCondition |
| examples/crm/src/ui/dashboards.ts | Converted 14 dashboard widget filters to MongoDB-style syntax |
| content/docs/references/ui/analytics/Report.mdx | Updated documentation to reflect filter schema change |
| | **groupingsAcross** | `object[]` | optional | Column groupings (Matrix only) | | ||
| | **filter** | `string` | optional | Filter logic (e.g. "1 AND (2 OR 3)") | | ||
| | **filterItems** | `object[]` | optional | Filter criteria lines | | ||
| | **filter** | `any` | optional | Filter criteria | |
There was a problem hiding this comment.
The filter type documentation should reference FilterCondition instead of any for clarity. This should be consistent with the schema change that uses FilterConditionSchema. Consider updating to: **filter** | FilterCondition | optional | Filter criteria
| | **filter** | `any` | optional | Filter criteria | | |
| | **filter** | `FilterCondition` | optional | Filter criteria | |
Filter Documentation & Code Standardization - COMPLETED ✅
Issues Identified
Documentation Updates Completed ✅
Code Updates Completed ✅
Summary of Changes
Migration Notes
[['field', '=', 'value']]→ New:{ field: 'value' }[['stage', '!=', 'won'], ['stage', '!=', 'lost']]→ New:{ stage: { $nin: ['won', 'lost'] } }filterobject with FilterConditionfiltersproperty (notwhere) for MongoDB-style filtersOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.