graphql-go / graphql

An implementation of GraphQL for Go / Golang
MIT License
9.91k stars 839 forks source link

Fix incorrect context hierarchy when using extensions #476

Closed sfriedel closed 5 years ago

sfriedel commented 5 years ago

When using an extension that creates new child contexts in ResolveFieldDidStart the resulting context hierarchy is wrong.

Given the query

query {
  a {
    foo
    bar
    baz
  }
}

the following context hierarchy would be created

a
|
+-> foo
    |
    +-> bar
        |
        +-> baz

So each context has the context of the previously executed field as a parent context.

This PR changes this so that the context in each field has the parent context of the parent field:

a
|
+-> foo
|    
+-> bar
|
+-> baz
coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.009%) to 92.37% when pulling 19e970422f7c3d9810409bf5d76f36a77d1d724b on civist:fix-context-hierarchy into 199d20bbfed70dae8c7d4619d4e0d339ce738b43 on graphql-go:master.

sfriedel commented 5 years ago

closing this PR for the now because we noticed that it breaks error propagation in some cases

Fontinalis commented 5 years ago

Sorry to hear, I was just about to look into the PR. Thanks Sebastian for starting to work on it!

I will look into it anyway, for some inspiration at least

On 2019. Apr 15., at 17:23, Sebastian Friedel notifications@github.com wrote:

Closed #476.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.