absinthe
absinthe copied to clipboard
Unable to name Absinthe object `:quote` when on Elixir 1.16
Environment
- Elixir version (elixir -v):
Erlang/OTP 26 [erts-14.2.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.16.2 (compiled with Erlang/OTP 26)
- Absinthe version (mix deps | grep absinthe):
* absinthe 1.7.6 (Hex package) (mix)
locked at 1.7.6 (absinthe) e7626951
* absinthe_plug 1.5.8 (Hex package) (mix)
locked at 1.5.8 (absinthe_plug) bbb04176
- Client Framework and version (Relay, Apollo, etc): Not applicable.
Expected behavior
We should be able to define Absinthe objects with the name :quote
.
Actual behavior
When you define an object like the following:
object :quote do
field :id, non_null(:id)
end
You'll get a compiler error like this on Elixir v1.16. This error did not occur on Elixir v1.15. I believe there was some change in Elixir v1.16 that has exposed this issue, but I think ultimately fix resides within Absinthe.
mix compile
Compiling 1 file (.ex)
== Compilation error in file lib/hello_web/schema/schema.ex ==
** (FunctionClauseError) no function clause matching in :lists.keydelete3/3
The following arguments were given to :lists.keydelete3/3:
# 1
:column
# 2
1
# 3
:__typename
(stdlib 5.2.2) lists.erl:885: :lists.keydelete3/3
(elixir 1.16.2) src/elixir_quote.erl:561: :elixir_quote.meta/2
(elixir 1.16.2) src/elixir_quote.erl:294: :elixir_quote.do_quote/3
(elixir 1.16.2) src/elixir_quote.erl:375: :elixir_quote.do_quote/3
(elixir 1.16.2) src/elixir_quote.erl:449: :elixir_quote.do_quote_splice/5
(elixir 1.16.2) src/elixir_quote.erl:375: :elixir_quote.do_quote/3
(elixir 1.16.2) src/elixir_quote.erl:449: :elixir_quote.do_quote_splice/5
(elixir 1.16.2) src/elixir_quote.erl:165: :elixir_quote.do_escape/3
Renaming the object to something like :quote2
addresses this issue.
Relevant Schema/Middleware Code
Simples schema to reproduce the issue:
defmodule HelloWeb.Schema do
use Absinthe.Schema
query do
field :hello, :string do
resolve &resolve_hello/3
end
end
object :quote do
field :id, non_null(:id)
end
def resolve_hello(_, _, _) do
{:ok, "Hello World!"}
end
end
Please see the attached sample application. hello.zip