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

Fix bookkeeping of Resolution path when resolving #1208

Merged
merged 3 commits into from
Nov 28, 2022

Commits on Nov 16, 2022

  1. Fix bookkeeping of Resolution path when resolving

    Addresses issue absinthe-graphql#1149.
    module `Absinthe.Phase.Document.Execution.Resolution` walks the result
    tree and tracks `path` using a function parameter. At the same time, a
    `Resolution` struct is passed, which `path` field is not consistently
    tracked.
    
    The problem manifests itself in bogus Resolution path passed onto
    `resolve_type` function as described in function absinthe-graphql#1149.
    
    The reason for not updating the resolution.path in the walk process can
    be explained by comment of @benwilson512: `Traditionally the reason we
    pass in the env has more to do with making the schema available and the
    context available, I don't know that the other values in that struct
    have been validated in this situation.` Perhaps path parameter was used
    in the beginning and later resolution paramter was added, but not used
    to track current tree walk in it's path field.
    
    Nevertheless, the resolution is passed on to user code - into
    `resolve_type(value, resolution)` callback, which might use path to
    understand the context of value (eg. what is the type of parent?).
    
    This PR fixes the bookkeeping of `resolution.path` field. I have not
    inspected the use of other field, I am not sure which ones would change
    during the value walk (`parent_type` maybe?).
    
    One could consider to just use `resolution.path` instead of `path`
    parameter - so there is not double bookkeeping of this value. This is up
    to maintainers to decide, I did not make such a change.
    marcinkoziej committed Nov 16, 2022
    Configuration menu
    Copy the full SHA
    d456298 View commit details
    Browse the repository at this point in the history

Commits on Nov 17, 2022

  1. Configuration menu
    Copy the full SHA
    ac9548a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    703c23f View commit details
    Browse the repository at this point in the history