zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Feature Request] The @@validate attribute could allow relations to be used (as @@allow does)

Open ludovicmotte opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. I wish I could use relations within the @@validate attribute to implement complex validations.

Describe the solution you'd like Let use this model: https://zenstack.dev/docs/the-complete-guide/part1/access-policy/relations#-to-one-relations And let's imagine a List has a state like "pending" or "open" I would like to be able to write something like this in the Todo model: @@validate(list.state!="pending", "You can't have a Todo for a pending list")

Describe alternatives you've considered On discord https://discord.com/channels/1035538056146595961/1224729455696810129 jiasheng suggested me to write @@deny('create, update', list.state!="pending") But it seems like a workaround because i implement a data validation with an access policy And I no longer have my custom error message.

ludovicmotte avatar Apr 09 '24 09:04 ludovicmotte