Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to name Absinthe object :quote when on Elixir 1.16 #1313

Open
deepankar-j opened this issue Apr 29, 2024 · 0 comments
Open

Unable to name Absinthe object :quote when on Elixir 1.16 #1313

deepankar-j opened this issue Apr 29, 2024 · 0 comments

Comments

@deepankar-j
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants