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

Dialyzer error when expecting "subscribed" key returned from Absinthe.run/3 #1234

Open
twinn opened this issue Mar 16, 2023 · 0 comments
Open

Comments

@twinn
Copy link

twinn commented Mar 16, 2023

Environment

  • Elixir version (elixir -v): 1.14.1
  • Absinthe version (mix deps | grep absinthe): 1.7.0
  • Client Framework and version (Relay, Apollo, etc): n/a

Expected behavior

mix dializer to recognize "subscribed" as a valid return key for Absinthe.run/3

Actual behavior

lib/subscription.ex:69:pattern_match
The pattern can never match the type.

Pattern:
{:ok, %{<<115, 117, 98, 115, 99, 114, 105, 98, 101, 100>> => _topic}}

Type:

  {:error, binary()}
  | {:ok,
     %{
       :data => nil | %{binary() => atom() | binary() | [map()] | number() | map()},
       :errors => [
         %{
           :message => binary(),
           :locations => [%{:column => integer(), :line => pos_integer()}]
         }
       ]
     }}

This is the Absinthe.run_result() type which doesn't expect to return a "subscribed" key as described in the Understanding Subscriptions Guide.

Relevant Schema/Middleware Code

  @spec run(t()) :: {:ok, String.t()}
  def run(%__MODULE__{
        runner_args: %{schema: schema, query: query, context: context, variables: variables}
      }) do
    {:ok, %{"subscribed" => topic}} = Absinthe.run(query, schema,
      context: context,
      variables: variables
    )
    {:ok, topic}
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant