Ash FrameworkAF
Ash Framework3y ago
9 replies
Blibs

Are accept fields in an update action required by default?

I have the following update action:

update :update_images do
  accept [:id, :status, :images]

  change set_attribute(:status, arg(:status), set_when_nil?: false)
  change set_attribute(:images, arg(:images))
end


I would expect that in this case the status is a optional field and will be nil if I don't send it as an action argument.

But if I do that, I actually get the following error:

     %Ash.Error.Changes.Required{
       field: :status,
       type: :attribute,
       resource: Marketplace.Markets.Property,
       changeset: nil,
       query: nil,
       error_context: [],
       vars: [],
       path: [],
       stacktrace: #Stacktrace<>,
       class: :invalid
     }


An I missing something of this is the expected behavior?
Was this page helpful?