I recently updated plug to 1.12.0 and am getting new Dialyzer errors.
lib/my_app_web/plugs/graphiql_context.ex:8:callback_arg_type_mismatch
The inferred type for the 1st argument is not a
supertype of the expected type for the call/2 callback
in the Plug behaviour.
Success type:
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:port => char(),
:private => %{:absinthe => map(), atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() =>
binary() | [binary() | [any()] | map()] | %{binary() => binary() | [any()] | map()}
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{binary(), binary()}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => map()},
:resp_headers => [{binary(), binary()}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state => :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset,
:status => nil | non_neg_integer()
}
Behaviour callback type:
%Plug.Conn{
:adapter => {atom(), _},
:assigns => %{atom() => _},
:before_send => [
(%Plug.Conn{
:adapter => {_, _},
:assigns => map(),
:before_send => [(_ -> any())],
_ => _
} ->
%Plug.Conn{
:adapter => {_, _},
:assigns => map(),
:before_send => [(_ -> any())],
_ => _
})
],
:body_params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:halted => boolean(),
:host => binary(),
:method => binary(),
:owner => pid(),
:params => %Plug.Conn.Unfetched{:aspect => atom(), binary() => _},
:path_info => [binary()],
:path_params => %{
binary() =>
binary()
| [binary() | [any()] | %{binary() => _}]
| %{binary() => binary() | [any()] | %{binary() => _}}
},
:port => char(),
:private => %{atom() => _},
:query_params => %Plug.Conn.Unfetched{
:aspect => atom(),
binary() =>
binary()
| [binary() | [any()] | %{binary() => _}]
| %{binary() => binary() | [any()] | %{binary() => _}}
},
:query_string => binary(),
:remote_ip =>
{byte(), byte(), byte(), byte()}
| {char(), char(), char(), char(), char(), char(), char(), char()},
:req_cookies => %Plug.Conn.Unfetched{:aspect => atom(), binary() => binary()},
:req_headers => [{binary(), binary()}],
:request_path => binary(),
:resp_body =>
nil
| binary()
| maybe_improper_list(
binary() | maybe_improper_list(any(), binary() | []) | byte(),
binary() | []
),
:resp_cookies => %{binary() => %{}},
:resp_headers => [{binary(), binary()}],
:scheme => :http | :https,
:script_name => [binary()],
:secret_key_base => nil | binary(),
:state => :chunked | :file | :sent | :set | :set_chunked | :set_file | :unset,
:status => nil | non_neg_integer()
}
The diff appear to be:
and
Line 8 is the def call function:
defmodule MyAppWeb.Plugs.GraphiQLContext do
@behaviour Plug
import Plug.Conn
def init(opts), do: opts
def call(conn, _) do
context = build_context(conn)
Absinthe.Plug.put_options(conn, context: context)
end
...
How do I resolve this?
Thank you