absinthe icon indicating copy to clipboard operation
absinthe copied to clipboard

Absinthe.Resolution.path_string/1 crashes if path includes a list

Open mdg opened this issue 5 months ago • 1 comments

I have a patch for this one ready. Just submitting the issue for referencing from the PR.

Environment

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

Expected behavior

Expected Absinthe.Resolution.path_string/1 to always return a list of strings and not raise a FunctionClauseError

Actual behavior

If the query path contains a list, the path value list contains an integer for the node in the path that is a list item. The fn passed to the map matches on maps and a FunctionClauseError is raised when it gets to the integer. case statement fails with a FunctionClause

Relevant Schema/Middleware Code

Schema has to include a list upstream from the field being resolved when path_string is called. https://github.com/absinthe-graphql/absinthe/blob/3d0823bd71c2ebb94357a5588c723e053de8c66a/lib/absinthe/resolution.ex#L238-L246

mdg avatar Sep 01 '24 22:09 mdg