Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Feature Request] Custom Function Examples

Aperta
#2,570 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
52/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
documentation

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
2.9k
Fork
157
Merge medio
11h 42m
PR unite (30g)
20

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di zenstackhq/zenstack

Tutte le issue di zenstackhq/zenstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.