you are passing raw value, but then …
Look that:
quote do
Schema.User
end
returns:
{:__aliases__, [alias: false], [:Schema, :User]}
so you can do:
defmodule Document.InputObjects.Schema do
# …
defp filter_name({:__aliases__, [alias: false], list}) do
list
|> List.delete("Schema")
|> Enum.join()
|> Macro.underscore()
|> append("_filter")
|> String.to_atom()
end
defp append(string, suffix), do: string <> suffix
# …
end
Secondly code is much cleaner when you are writing it top → bottom instead of bottom → top. It’s faster to read it.
Finally make sure you are using Elixir builtin code formatter:
https://hexdocs.pm/mix/master/Mix.Tasks.Format.html






















