Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Feature Request] Custom Function Examples

Open
#2,570 0 comments 2 reactions 0 assignees View on GitHub

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:

  1. How to declare a custom function in the .zmodel file.
  2. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zenstackhq/zenstack

All issues in zenstackhq/zenstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.