Hello we are trying to validate params and then change the second argument
inside a decorator to the thingy that we cast using Ecto.Changeset
Does any one know how can this be accomplished, I've found a wall of knowledge
working with ast
def validate_params(module, body, %{args: [conn, params]}) do
quote do
result = unquote(module).validate(unquote(params))
case result do
{:ok, new_params} ->
# Here I would like the new_params to be inside body
unquote(body)
[...]
end
end
end
@decorate validate_params(Params.That)
def all(conn, params) do
# now params here are the result of Params.That.validate(params)
[...]
end