Skip to content

Commit

Permalink
Rewritten execution pipeline
Browse files Browse the repository at this point in the history
The execution pipeline has been rewritten to improve readability in some
areas, and fix the result marshalling bugs that were popping up. The
summary of the changes is:

  * support for the Node interface method of boundary field lookup has
  been dropped. It was only supported for a brief window and everything
  should be using the better @boundary method.
  * execution results are now collected before the merging step. This
  means all results are stored in their own map and will not be mutated
  as other steps execute.
  * null bubbling as per the GraphQL spec is now done in it's own step.
  * when formatting the response, the selection set is now used as the
  source of truth. This is done to better accomodate queries using
  fragments that currently break in some scenarios. These cases should
  now be fixed.
  * there is no more partial unmarshalling, all results are unmarshalled
  into either map[string]interface{} or []interface. This means there
  are no steps of the pipeline that get conditionally skipped, as is the case
  right now.
  * tracing is gone from the execution related code as it was not
  being used.

Co-authored-by: Nicolas Maquet <[email protected]>
Co-authored-by: Malcolm Lockyer <[email protected]>
  • Loading branch information
3 people committed Sep 26, 2021
1 parent 93ae867 commit d9902cc
Show file tree
Hide file tree
Showing 10 changed files with 4,103 additions and 1,124 deletions.
7 changes: 7 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"time"

opentracing "github.com/opentracing/opentracing-go"
"github.com/vektah/gqlparser/v2/ast"
)

// GraphQLClient is a GraphQL client.
Expand Down Expand Up @@ -144,6 +145,11 @@ func NewRequest(body string) *Request {
}
}

func (r *Request) WithHeaders(headers http.Header) *Request {
r.Headers = headers
return r
}

// Response is a GraphQL response
type Response struct {
Errors GraphqlErrors `json:"errors"`
Expand All @@ -157,6 +163,7 @@ type GraphqlErrors []GraphqlError
// GraphqlError is a single GraphQL error
type GraphqlError struct {
Message string `json:"message"`
Path ast.Path `json:"path,omitempty"`
Extensions map[string]interface{} `json:"extensions"`
}

Expand Down
Loading

0 comments on commit d9902cc

Please sign in to comment.