Accept subset of Ash.Type.Enum in action
I have an
And the
In my create action I'd like to accept a role argument, but only
Ash.Type.Enum defined as And the
User resource is using it withIn my create action I'd like to accept a role argument, but only
:farmer or :farmhand should be allowed, and ideally I'd like to keep all the benefits of using Ash.Type.Enum like automatic casting. What would be the idiomatic way of accomplishing this?Solution
for your first question you can use a validation https://hexdocs.pm/ash/Ash.Resource.Validation.Builtins.html#attribute_in/2
