Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ludovicmotte opened this issue Apr 9, 2024 · 0 comments

Comments

@ludovicmotte
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant