Skip to content

docs: parameterized computed fields#630

Open
evgenovalov wants to merge 2 commits into
zenstackhq:mainfrom
evgenovalov:docs/parameterized-computed-fields
Open

docs: parameterized computed fields#630
evgenovalov wants to merge 2 commits into
zenstackhq:mainfrom
evgenovalov:docs/parameterized-computed-fields

Conversation

@evgenovalov

@evgenovalov evgenovalov commented Jul 20, 2026

Copy link
Copy Markdown

What

Documents the parameterized @computed fields feature on the ORM Computed Fields page.

Adds a Parameterized Computed Fields section covering:

  • the ZModel parameter syntax — recentPostCount(since: DateTime) Int @computed
  • the implementation signature (a third args argument, typed from the declared parameters)
  • supplying args across every read context: orderBy, where (and having), select / include, aggregate (_count / _sum / _avg / _min / _max), and groupBy by
  • that a parameterized field isn't auto-returned (must be requested via select / include)
  • a note that grouping by a correlated-subquery computed field is subject to the database's own correlated-GROUP BY rules

Related

This documents the API as of those PRs. Happy to adjust if the API shape changes during review — the page can merge alongside the v3.9 release.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added guidance for using parameterized computed fields.
    • Documented typed schema parameters and callback argument handling.
    • Explained how to supply parameters in filtering, sorting, selection, aggregation, and grouping queries.
    • Clarified that parameterized computed fields are not returned by default.

Add a "Parameterized Computed Fields" section to the ORM computed-fields page:
the ZModel parameter syntax, the 3-argument implementation signature, how to
supply `args` across orderBy / where / select / include / aggregate / groupBy,
and a note on grouping by a correlated-subquery computed field.

Documents zenstackhq/zenstack#2744 and zenstackhq/zenstack#2762.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the ZenStack Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@evgenovalov, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 55 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b9989e08-5be4-4160-912f-740db2d506d1

📥 Commits

Reviewing files that changed from the base of the PR and between 1aa7b4d and beca7ac.

📒 Files selected for processing (1)
  • docs/orm/computed-fields.md

Walkthrough

Adds documentation for declaring, implementing, and querying parameterized computed fields, including explicit argument passing and selection requirements.

Changes

Parameterized Computed Fields

Layer / File(s) Summary
Parameterized field declaration and query usage
docs/orm/computed-fields.md
Documents typed schema parameters, the callback’s third args parameter, explicit query-time argument passing, and selection requirements across ordering, filtering, selection, and aggregation.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: documentation for parameterized computed fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/orm/computed-fields.md`:
- Around line 83-85: Update the “Parameterized Computed Fields” section in
computed-fields.md by importing AvailableSince from the relative
_components/AvailableSince path and placing an <AvailableSince version="v3.9.0"
/> component immediately below that heading.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e47bf9d5-1228-49e0-aea8-01f162909d0c

📥 Commits

Reviewing files that changed from the base of the PR and between bf4c80d and 1aa7b4d.

📒 Files selected for processing (1)
  • docs/orm/computed-fields.md

Comment thread docs/orm/computed-fields.md
New-feature docs must carry an <AvailableSince> release marker (review feedback).
Imported from `../_components/AvailableSince` to match this file's other component
imports (the suggested `./_components` path is incorrect — the component lives at
docs/_components/).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant