My app has a plug that has access to a struct that it wants to make available downstream, to Ash resources that use AshGraphql.
I found Ash.PlugHelpers.set_context/2
, which might be the right function for the job.
I’m using AshGraphql in a resource module. It defines a :create_cart_payment_method
mutation that delegates to the :create_payment_method
action in the resource. In the change/2
callback of that action, the second argument is a context. At the top of the Ash.Resource.Change
moduledoc, it describes, “the context, which currently only has the actor.”.
It appears these two “contexts” may not be the same thing. Nothing in the AshGraphql documentation mentions the “context” from Ash.PlugHelpers.set_context/2
.
How should I pass my struct value to the change/2
function in the resource’s action, from the context that was set with Ash.PlugHelpers.set_context/2
?