AST values in meta attributes
Closed this issue · 3 comments
Elixir version: 1.8.1
On Absinthe v1.4.13, meta attributes can contain anonymous functions:
field :foo, :foo do
meta :key, &(&1)
end
And when retrieving the meta value during runtime, the anonymous function works as expected.
On the latest master
(7f7cb9e at this time), the value obtained during runtime is the AST of the function (({:&, [line: 93], [{:&, [line: 93], [1]}]}
) instead of the function.
Our app currently walks the fields of the query and gathers some information via meta tags prior to execution, and the use of anonymous functions here has been very valuable.
What is the expected behavior of having an anonymous function in this location?
The expected behavior would be when calling Absinthe.Type.meta(schema_node, :key)
during runtime you would receive an anonymous function instead of the AST.
Hey @stavro, you should be able to solve this by extracting the function to a named function and doing meta :key, &SomeModule.some_function/1
. While Absinthe supports inline anonymous resolver functions, doing so has come at an enormous complexity cost, and we don't plan to continue supporting inline anonymous functions for other properties.