-
-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Milestone
Description
Is your feature request related to a problem? Please describe.
When developing complex access policies or validation a single zmodel can quickly get very chaotic.
Describe the solution you'd like
A way to put model-level access policies and validation in a separate file or abstract model.
Describe alternatives you've considered
We tried creating abstract models, which contain the model-level policies, but for Zenstack to recognize the fields
we would have to extend a common base model, which it then complains is extended from multiple times.
abstract model CounterSchema {
name String
value Int
}
//! If we don't extend CounterSchema here, Zenstack doesn't recognize "value"
abstract model CounterCreate extends CounterSchema {
@@allow("create", value >= 0)
}
//! If we don't extend CounterSchema here, Zenstack doesn't recognize "name"
abstract model CounterRead extends CounterSchema {
@@allow("read", name == "It should be readable")
}
//! This fails compilation because CounterSchema is extended twice
model Counter extends CounterCreate, CounterRead {
id String @id
}Metadata
Metadata
Assignees
Labels
No labels