Skip to content

[Feature Request] Custom Function Examples #2570

@caiotarifa

Description

@caiotarifa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions