How do cleanly do action accepts for resources with a lot of attributes without `:*`?
With
:*
being deprecated in the future major version of Ash. Will you have to put all attributes in the accepts for the actions need to support all attributes?
The answer very well may be you just have to list all the attributes in the action. But wanted to check.9 Replies
yep, listing all the attributes
There are other options too
Solution
default_accept
in the top level actions blockAnd
@accepted [...]
at the top of the module
But if it's a lot of attributes and just a couple actions, explicit lists is simplest and least error prone@accepted
is new to me - that isn't listed here https://hexdocs.pm/ash/actions.html#accepting-inputsok. The full lists will typically only be on primary
:create
or :update
, so that seems reasonable. It'll just be a big change from doing :*
. But I don't like putting all my attrs as public?: true
just to use :*
since it's going to be deprecated in the future.
Thanks for the info.especially because
public? true
has other impacts as well, like making things accessible via APIs if you have them set up
they're meant for actual public attributes, not as a shortcut for making them settable in actionsSubmitted a PR to add this to the
accept-inputs
docs.ahhhhh I thought there was some secret special handling of a module attribute called
@accepted
or something