JSON API patch without bulk update

Is is possible to do a PATCH with ash_json_api that will do an update that doesn't use bulk_update? I'm wanting to write an update policy that's essentially a runtime policy (i.e. it needs access to the object that's changing in order to validate). Poking around source code though, it looks like PATCHes are always implemented with bulk updates?
3 Replies
Jesse Williams
Jesse WilliamsOP2mo ago
(since it's implemented as a bulk update, I wind up with an %Ash.Changeset.OriginalDataNotAvailable{} struct passed into my check)
barnabasj
barnabasj2mo ago
%Ash.Changeset.OriginalDataNotAvailable{} is because it's trying to do the update atomically. There is a callback in Ash.Policy.Check that tells Ash if the data is needed for the check, but Ash.Policy.SimpleCheck returns false by default, but you can overwrite it.

Did you find this page helpful?