-
Notifications
You must be signed in to change notification settings - Fork 527
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
fix path_string crash when path includes list #1338
base: main
Are you sure you want to change the base?
Conversation
in Absinthe.Resolution; also: * add documentation for path_string/1 * add specs for path/1 and path_string/1 this fix is absinthe-graphql#1337 absinthe-graphql#1337
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the correct
@@ -128,6 +128,7 @@ defmodule Absinthe.Resolution do | |||
In this case `5` is the 0 based index in the list of users the field is currently | |||
at. | |||
""" | |||
@spec path(t()) :: [String.t()] | |||
def path(%{path: path}) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this spec is correct. This returns the query nodes, not strings. Also, in the case of lists, it returns integers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll switch to [String.t() | integer()]
lib/absinthe/resolution.ex
Outdated
|
||
```elixir | ||
resolve fn _, _, resolution -> | ||
Absinthe.Resolution.path(resolution) #=> ["email", "users", "RootQueryType"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The desired output here is probably to stringify the integer so that the information isn't lost. This is also a breaking change so we'll need to release this under a new minor version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added back the integers as strings. I would suggest this isn't a breaking change, b/c no one was using the previous behavior b/c it was broken.
fix the type on Resolution.path/1 incorporating PR feedback from @benwilson512 issue absinthe-graphql#1337
I've tried to address the feedback |
in Absinthe.Resolution; also:
this fix is #1337