I'm using macros and I want to pass a dynamic identifier to an Absinthe macro enum
, wanting to generate different enum
s with a set list. Everything is inside a for
comprehension.
I've read that Kernel.apply/3
does not work on macros.
- I've also tried:
for name <- [:hello, :world] do
enum unquote(name) do
value(:approved)
end
end
Getting as a result:
** (ArgumentError) argument error
:erlang.atom_to_binary({:unquote, [line: 36], [{:name, [line: 36], nil}]}, :utf8)
- I also tried without the unquote:
for name <- [:hello, :world] do
enum name do
value(:approved)
end
end
And get:
** (ArgumentError) argument error
:erlang.atom_to_binary({:name, [line: 36], nil}, :utf8)
It seems that I can't unquote anything that I pass as the identifier of the macro enum
. Is it possible to do this?