[Feature Request] Custom Function Examples
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- documentation
Research direction
The payload names the functions page at https://zenstack.dev/docs/reference/zmodel/function. Start by reading that page and nearby zmodel reference pages to see the existing example style. Add a short snippet that declares a custom function with parameters and a return type, plus how to call it inside an @allow policy rule. Done when the page includes both examples and the snippet matches the v3 syntax; preview the docs build to confirm it renders.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
The v3 documentation mentions:
and you can also define your own functions in the schema.
However, there are no examples showing how to actually do this. It's currently hard to figure out the correct syntax for parameters, return types, and how to use them inside policies.
Describe the solution you'd like
It would be great to add a short code snippet to the functions page demonstrating:
- How to declare a custom function in the
.zmodelfile. - How to call it inside a policy rule (e.g.,
@allow).
Describe alternatives you've considered
Trying to guess the syntax via trial and error or searching for examples in the Discord community.
Additional context
https://zenstack.dev/docs/reference/zmodel/function
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 157
- Avg merge
- 11h 42m
- Merged PRs (30d)
- 20
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zenstackhq/zenstack
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
zenstackhq/zenstack#2873 ·
Maintainers usually reply within 1 day
-
runtime
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zenstackhq/zenstack#2868 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
zenstackhq/zenstack#2694 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
zenstackhq/zenstack#2659 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
zenstackhq/zenstack#2542 · 1 comment ·
Maintainers usually reply within 1 day
All issues in zenstackhq/zenstack
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
area:cowork area:desktop documentation enhancement platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anthropics/claude-code#101720 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
apache/rocketmq-dashboard#6610 ·
Maintainers usually reply within 3 days
-
Add: MS NOWOpencheck:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)Possibly taken @PINYOPATTANAWASANPORN claimed this today. Openarea: core Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#18674 · 1 comment ·
Maintainers usually reply within 1 day