absinthe-graphql/absinthe_relay

Warning on creating node object

michaelst opened this issue · 2 comments

When I define a node object I will get 4 warnings about the clause not matching. If I remove node from in front of object then the error goes away.

Current versions:
absinthe 1.5.0-rc.3
absinthe_plug 1.5.0-rc.2
absinthe_relay 1.5.0-rc.0

elixir -v
Erlang/OTP 22 [erts-10.5.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.10.2 (compiled with Erlang/OTP 22)
defmodule ZB.JournalEntryLine.Types.Queries do
  use Absinthe.Schema.Notation
  use Absinthe.Relay.Schema.Notation, :modern

  node object(:journal_entry_line) do
    field(:id, :id)
  end
end
warning: this clause cannot match because a previous clause at line 1 always matches
  lib/zb/banks/bank_member/types/queries.ex:1

warning: this clause cannot match because a previous clause at line 1 always matches
  lib/zb/banks/bank_member/types/queries.ex:1

warning: this clause cannot match because a previous clause at line 1 always matches
  lib/zb/banks/bank_member/types/queries.ex:1

warning: this clause cannot match because a previous clause at line 1 always matches
  lib/zb/banks/bank_member/types/queries.ex:1

Realized after I created this issue that I had set the id field, which you shouldn't do on node objects. A better warning might be nice.

Seconding this notion.