From e9389ef8f8eee80eec108983575ed303e99000e9 Mon Sep 17 00:00:00 2001 From: Chris Belsole Date: Sat, 18 May 2019 14:33:42 -0400 Subject: [PATCH 01/30] added schema file globbing fixes #631 --- codegen/config/config.go | 31 +++++++++++++++++-- codegen/config/config_test.go | 14 +++++++++ codegen/config/testdata/cfg/glob.yml | 9 ++++++ .../cfg/glob/bar/bar with spaces.graphql | 12 +++++++ .../config/testdata/cfg/glob/foo/foo.graphql | 11 +++++++ codegen/config/testdata/cfg/unwalkable.yml | 9 ++++++ 6 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 codegen/config/testdata/cfg/glob.yml create mode 100644 codegen/config/testdata/cfg/glob/bar/bar with spaces.graphql create mode 100644 codegen/config/testdata/cfg/glob/foo/foo.graphql create mode 100644 codegen/config/testdata/cfg/unwalkable.yml diff --git a/codegen/config/config.go b/codegen/config/config.go index 1725adab0e8..4d642c6140a 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "sort" "strings" @@ -67,9 +68,33 @@ func LoadConfig(filename string) (*Config, error) { preGlobbing := config.SchemaFilename config.SchemaFilename = StringList{} for _, f := range preGlobbing { - matches, err := filepath.Glob(f) - if err != nil { - return nil, errors.Wrapf(err, "failed to glob schema filename %s", f) + var matches []string + + // for ** we want to override default globbing patterns and walk all + // subdirectories to match schema files. + if strings.Contains(f, "**") { + pathParts := strings.SplitN(f, "**", 2) + if err := filepath.Walk(pathParts[0], func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + // make sure paths match files + // ?.*\. + fileRegex := regexp.MustCompile(pathParts[0] + "?.*" + strings.Replace(strings.Replace(pathParts[1], ".", "\\.", -1), "*", ".+", -1)) + if fileRegex.MatchString(path) { + matches = append(matches, path) + } + + return nil + }); err != nil { + return nil, errors.Wrapf(err, "failed to walk schema at root %s", pathParts[0]) + } + } else { + matches, err = filepath.Glob(f) + if err != nil { + return nil, errors.Wrapf(err, "failed to glob schema filename %s", f) + } } for _, m := range matches { diff --git a/codegen/config/config_test.go b/codegen/config/config_test.go index 6ac5257cfdd..1a22c3fda98 100644 --- a/codegen/config/config_test.go +++ b/codegen/config/config_test.go @@ -1,6 +1,7 @@ package config import ( + "fmt" "os" "path/filepath" "testing" @@ -24,6 +25,19 @@ func TestLoadConfig(t *testing.T) { _, err := LoadConfig("testdata/cfg/unknownkeys.yml") require.EqualError(t, err, "unable to parse config: yaml: unmarshal errors:\n line 2: field unknown not found in type config.Config") }) + + t.Run("globbed filenames", func(t *testing.T) { + c, err := LoadConfig("testdata/cfg/glob.yml") + require.NoError(t, err, "") + fmt.Printf("%+v\n", c) + require.Equal(t, c.SchemaFilename[0], "testdata/cfg/glob/bar/bar with spaces.graphql") + require.Equal(t, c.SchemaFilename[1], "testdata/cfg/glob/foo/foo.graphql") + }) + + t.Run("unwalkable path", func(t *testing.T) { + _, err := LoadConfig("testdata/cfg/unwalkable.yml") + require.EqualError(t, err, "failed to walk schema at root not_walkable/: lstat not_walkable/: no such file or directory") + }) } func TestLoadDefaultConfig(t *testing.T) { diff --git a/codegen/config/testdata/cfg/glob.yml b/codegen/config/testdata/cfg/glob.yml new file mode 100644 index 00000000000..87edd2cff56 --- /dev/null +++ b/codegen/config/testdata/cfg/glob.yml @@ -0,0 +1,9 @@ +schema: +- testdata/cfg/glob/**/*.graphql +exec: + filename: generated.go +model: + filename: models_gen.go +resolver: + filename: resolver.go + type: Resolver diff --git a/codegen/config/testdata/cfg/glob/bar/bar with spaces.graphql b/codegen/config/testdata/cfg/glob/bar/bar with spaces.graphql new file mode 100644 index 00000000000..b01bcc433a2 --- /dev/null +++ b/codegen/config/testdata/cfg/glob/bar/bar with spaces.graphql @@ -0,0 +1,12 @@ +type Query { + todos: [Todo!]! +} + +input NewTodo { + text: String! + userId: String! +} + +type Mutation { + createTodo(input: NewTodo!): Todo! +} diff --git a/codegen/config/testdata/cfg/glob/foo/foo.graphql b/codegen/config/testdata/cfg/glob/foo/foo.graphql new file mode 100644 index 00000000000..5f0496c9731 --- /dev/null +++ b/codegen/config/testdata/cfg/glob/foo/foo.graphql @@ -0,0 +1,11 @@ +type Todo { + id: ID! + text: String! + done: Boolean! + user: User! +} + +type User { + id: ID! + name: String! +} diff --git a/codegen/config/testdata/cfg/unwalkable.yml b/codegen/config/testdata/cfg/unwalkable.yml new file mode 100644 index 00000000000..2eac23e2e64 --- /dev/null +++ b/codegen/config/testdata/cfg/unwalkable.yml @@ -0,0 +1,9 @@ +schema: +- not_walkable/**/*.graphql +exec: + filename: generated.go +model: + filename: models_gen.go +resolver: + filename: resolver.go + type: Resolver From e32c82be0f3d562b149c01b08f459b6515b75aca Mon Sep 17 00:00:00 2001 From: Chris Belsole Date: Sat, 18 May 2019 14:36:09 -0400 Subject: [PATCH 02/30] cleanup --- codegen/config/config.go | 5 ++++- codegen/config/config_test.go | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/codegen/config/config.go b/codegen/config/config.go index 4d642c6140a..1139a66ec0b 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -81,7 +81,10 @@ func LoadConfig(filename string) (*Config, error) { // make sure paths match files // ?.*\. - fileRegex := regexp.MustCompile(pathParts[0] + "?.*" + strings.Replace(strings.Replace(pathParts[1], ".", "\\.", -1), "*", ".+", -1)) + fileRegex := regexp.MustCompile( + pathParts[0] + + "?.*" + + strings.Replace(strings.Replace(pathParts[1], ".", "\\.", -1), "*", ".+", -1)) if fileRegex.MatchString(path) { matches = append(matches, path) } diff --git a/codegen/config/config_test.go b/codegen/config/config_test.go index 1a22c3fda98..e84f940f9f5 100644 --- a/codegen/config/config_test.go +++ b/codegen/config/config_test.go @@ -1,7 +1,6 @@ package config import ( - "fmt" "os" "path/filepath" "testing" @@ -28,8 +27,8 @@ func TestLoadConfig(t *testing.T) { t.Run("globbed filenames", func(t *testing.T) { c, err := LoadConfig("testdata/cfg/glob.yml") - require.NoError(t, err, "") - fmt.Printf("%+v\n", c) + require.NoError(t, err) + require.Equal(t, c.SchemaFilename[0], "testdata/cfg/glob/bar/bar with spaces.graphql") require.Equal(t, c.SchemaFilename[1], "testdata/cfg/glob/foo/foo.graphql") }) From 39db147719f48556710f1f5afedf6e79bc8affc4 Mon Sep 17 00:00:00 2001 From: Chris Belsole Date: Sat, 18 May 2019 14:38:48 -0400 Subject: [PATCH 03/30] updated docs --- docs/content/config.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/content/config.md b/docs/content/config.md index 98cb7127e8b..eee5cb60520 100644 --- a/docs/content/config.md +++ b/docs/content/config.md @@ -17,11 +17,15 @@ schema: schema.graphql schema: - schema.graphql - user.graphql - + # Or you can use globs -schema: +schema: - "*.graphql" - + +# Or globs from a root directory +schema: + - "schema/**/*.graphql" + # Let gqlgen know where to put the generated server exec: filename: graph/generated/generated.go From 3dd8baf528b79dc3945f6a156c7cb7316ef87479 Mon Sep 17 00:00:00 2001 From: marwan-at-work Date: Wed, 22 May 2019 08:07:50 -0400 Subject: [PATCH 04/30] resolve all pkg dependencies --- codegen/config/binder.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/codegen/config/binder.go b/codegen/config/binder.go index cea904ada33..72956de4d1e 100644 --- a/codegen/config/binder.go +++ b/codegen/config/binder.go @@ -14,7 +14,7 @@ import ( // Binder connects graphql types to golang types using static analysis type Binder struct { - pkgs []*packages.Package + pkgs map[string]*packages.Package schema *ast.Schema cfg *Config References []*TypeReference @@ -26,7 +26,9 @@ func (c *Config) NewBinder(s *ast.Schema) (*Binder, error) { return nil, err } + mp := map[string]*packages.Package{} for _, p := range pkgs { + populatePkg(mp, p) for _, e := range p.Errors { if e.Kind == packages.ListError { return nil, p.Errors[0] @@ -35,12 +37,23 @@ func (c *Config) NewBinder(s *ast.Schema) (*Binder, error) { } return &Binder{ - pkgs: pkgs, + pkgs: mp, schema: s, cfg: c, }, nil } +func populatePkg(mp map[string]*packages.Package, p *packages.Package) { + imp := code.NormalizeVendor(p.PkgPath) + if _, ok := mp[imp]; ok { + return + } + mp[imp] = p + for _, p := range p.Imports { + populatePkg(mp, p) + } +} + func (b *Binder) TypePosition(typ types.Type) token.Position { named, isNamed := typ.(*types.Named) if !isNamed { @@ -75,10 +88,9 @@ func (b *Binder) FindType(pkgName string, typeName string) (types.Type, error) { } func (b *Binder) getPkg(find string) *packages.Package { - for _, p := range b.pkgs { - if code.NormalizeVendor(find) == code.NormalizeVendor(p.PkgPath) { - return p - } + imp := code.NormalizeVendor(find) + if p, ok := b.pkgs[imp]; ok { + return p } return nil } From d36932c55ee97e41567eb9c42d49a884388095d0 Mon Sep 17 00:00:00 2001 From: DBL-Lee Date: Fri, 31 May 2019 14:53:06 -0700 Subject: [PATCH 05/30] support automatic persisted query --- handler/graphql.go | 94 ++++++++++++++++++++++++++++++++++++++--- handler/graphql_test.go | 23 ++++++++++ 2 files changed, 111 insertions(+), 6 deletions(-) diff --git a/handler/graphql.go b/handler/graphql.go index a22542225fc..78deb6fb485 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -2,6 +2,8 @@ package handler import ( "context" + "crypto/sha256" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -28,8 +30,23 @@ type params struct { Query string `json:"query"` OperationName string `json:"operationName"` Variables map[string]interface{} `json:"variables"` + Extensions *extensions `json:"extensions"` } +type extensions struct { + PQ *persistedQuery `json:"persistedQuery"` +} + +type persistedQuery struct { + Sha256 string `json:"sha256Hash"` + Version int64 `json:"version"` +} + +const ( + errPersistedQueryNotSupported = "PersistedQueryNotSupported" + errPersistedQueryNotFound = "PersistedQueryNotFound" +) + type Config struct { cacheSize int upgrader websocket.Upgrader @@ -44,6 +61,7 @@ type Config struct { connectionKeepAlivePingInterval time.Duration uploadMaxMemory int64 uploadMaxSize int64 + apqCacheSize int } func (c *Config) newRequestContext(es graphql.ExecutableSchema, doc *ast.QueryDocument, op *ast.OperationDefinition, query string, variables map[string]interface{}) *graphql.RequestContext { @@ -285,6 +303,14 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option { } } +// APQCacheSize sets the maximum size of the automatic persisted query cache. +// If size is less than or equal to 0, the cache is disabled. +func APQCacheSize(size int) Option { + return func(cfg *Config) { + cfg.apqCacheSize = size + } +} + const DefaultCacheSize = 1000 const DefaultConnectionKeepAlivePingInterval = 25 * time.Second @@ -327,10 +353,22 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc cfg.tracer = &graphql.NopTracer{} } + var apqCache *lru.Cache + if cfg.apqCacheSize > 0 { + var err error + apqCache, err = lru.New(cfg.apqCacheSize) + if err != nil { + // An error is only returned for non-positive cache size + // and we already checked for that. + panic("unexpected error creating apq cache: " + err.Error()) + } + } + handler := &graphqlHandler{ - cfg: cfg, - cache: cache, - exec: exec, + cfg: cfg, + cache: cache, + exec: exec, + apqCache: apqCache, } return handler.ServeHTTP @@ -339,9 +377,15 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc var _ http.Handler = (*graphqlHandler)(nil) type graphqlHandler struct { - cfg *Config - cache *lru.Cache - exec graphql.ExecutableSchema + cfg *Config + cache *lru.Cache + exec graphql.ExecutableSchema + apqCache *lru.Cache +} + +func computeQueryHash(query string) string { + b := sha256.Sum256([]byte(query)) + return hex.EncodeToString(b[:]) } func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { @@ -409,6 +453,39 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() + var queryHash string + apq := reqParams.Extensions != nil && reqParams.Extensions.PQ != nil + if apq { + // client has enabled apq + queryHash = reqParams.Extensions.PQ.Sha256 + if gh.apqCache == nil { + // server has disabled apq + sendErrorf(w, http.StatusOK, errPersistedQueryNotSupported) + return + } + if reqParams.Extensions.PQ.Version != 1 { + sendErrorf(w, http.StatusOK, "Unsupported persisted query version") + return + } + if reqParams.Query == "" { + // client sent optimistic query hash without query string + query, ok := gh.apqCache.Get(queryHash) + if !ok { + sendErrorf(w, http.StatusOK, errPersistedQueryNotFound) + return + } + reqParams.Query = query.(string) + } else { + if computeQueryHash(reqParams.Query) != queryHash { + sendErrorf(w, http.StatusOK, "provided sha does not match query") + return + } + } + } else if reqParams.Query == "" { + sendErrorf(w, http.StatusUnprocessableEntity, "Must provide query string") + return + } + var doc *ast.QueryDocument var cacheHit bool if gh.cache != nil { @@ -463,6 +540,11 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + if apq && gh.apqCache != nil { + // Add to persisted query cache + gh.apqCache.Add(queryHash, reqParams.Query) + } + switch op.Operation { case ast.Query: b, err := json.Marshal(gh.exec.Query(ctx, op)) diff --git a/handler/graphql_test.go b/handler/graphql_test.go index c97c5290ea9..a2627c77197 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -764,3 +764,26 @@ func TestBytesRead(t *testing.T) { require.Equal(t, "0193456789", string(got)) }) } + +func TestAutomaticPersistedQuery(t *testing.T) { + h := GraphQL(&executableSchemaStub{}, APQCacheSize(1000)) + t.Run("automatic persisted query", func(t *testing.T) { + // normal queries should be unaffected + resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + // first pass: optimistic hash without query string + resp = doRequest(h, "POST", "/graphql", `{"extensions":{"persistedQuery":{"sha256Hash":"b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88","version":1}}}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"errors":[{"message":"PersistedQueryNotFound"}],"data":null}`, resp.Body.String()) + // second pass: query with query string and query hash + resp = doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }", "extensions":{"persistedQuery":{"sha256Hash":"b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88","version":1}}}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + // future requests without query string + resp = doRequest(h, "POST", "/graphql", `{"extensions":{"persistedQuery":{"sha256Hash":"b8d9506e34c83b0e53c2aa463624fcea354713bc38f95276e6f0bd893ffb5b88","version":1}}}`) + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) +} From 8dc17b470d339f5fcd6e1cf9a3d14dec2df4067e Mon Sep 17 00:00:00 2001 From: DBL-Lee Date: Fri, 31 May 2019 15:30:08 -0700 Subject: [PATCH 06/30] support GET for apq --- handler/graphql.go | 7 +++++++ handler/graphql_test.go | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/handler/graphql.go b/handler/graphql.go index 78deb6fb485..6f965f86000 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -413,6 +413,13 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } } + + if extensions := r.URL.Query().Get("extensions"); extensions != "" { + if err := jsonDecode(strings.NewReader(extensions), &reqParams.Extensions); err != nil { + sendErrorf(w, http.StatusBadRequest, "extensions could not be decoded") + return + } + } case http.MethodPost: mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type")) if err != nil { diff --git a/handler/graphql_test.go b/handler/graphql_test.go index a2627c77197..93a257706de 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -767,7 +767,7 @@ func TestBytesRead(t *testing.T) { func TestAutomaticPersistedQuery(t *testing.T) { h := GraphQL(&executableSchemaStub{}, APQCacheSize(1000)) - t.Run("automatic persisted query", func(t *testing.T) { + t.Run("automatic persisted query POST", func(t *testing.T) { // normal queries should be unaffected resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) assert.Equal(t, http.StatusOK, resp.Code) @@ -786,4 +786,24 @@ func TestAutomaticPersistedQuery(t *testing.T) { assert.Equal(t, http.StatusOK, resp.Code) assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) }) + + t.Run("automatic persisted query GET", func(t *testing.T) { + // normal queries should be unaffected + resp := doRequest(h, "GET", "/graphql?query={me{name}}", "") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + + // first pass: optimistic hash without query string + resp = doRequest(h, "GET", `/graphql?extensions={"persistedQuery":{"version":1,"sha256Hash":"b58723c4fd7ce18043ae53635b304ba6cee765a67009645b04ca01e80ce1c065"}}`, "") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"errors":[{"message":"PersistedQueryNotFound"}],"data":null}`, resp.Body.String()) + // second pass: query with query string and query hash + resp = doRequest(h, "GET", `/graphql?query={me{name}}&extensions={"persistedQuery":{"sha256Hash":"b58723c4fd7ce18043ae53635b304ba6cee765a67009645b04ca01e80ce1c065","version":1}}}`, "") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + // future requests without query string + resp = doRequest(h, "GET", `/graphql?extensions={"persistedQuery":{"version":1,"sha256Hash":"b58723c4fd7ce18043ae53635b304ba6cee765a67009645b04ca01e80ce1c065"}}`, "") + assert.Equal(t, http.StatusOK, resp.Code) + assert.Equal(t, `{"data":{"name":"test"}}`, resp.Body.String()) + }) } From 48292c1020344b7686efa6667ea16ed7706ece14 Mon Sep 17 00:00:00 2001 From: Igor Ivanov Date: Wed, 12 Jun 2019 11:44:26 +0200 Subject: [PATCH 07/30] Support pluggable APQ cache implementations. --- handler/graphql.go | 47 ++++++++++++++++++----------------------- handler/graphql_test.go | 25 +++++++++++++++++++++- 2 files changed, 44 insertions(+), 28 deletions(-) diff --git a/handler/graphql.go b/handler/graphql.go index 6f965f86000..67420950588 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -34,7 +34,7 @@ type params struct { } type extensions struct { - PQ *persistedQuery `json:"persistedQuery"` + PersistedQuery *persistedQuery `json:"persistedQuery"` } type persistedQuery struct { @@ -47,6 +47,11 @@ const ( errPersistedQueryNotFound = "PersistedQueryNotFound" ) +type PersistedQueryCache interface { + Add(ctx context.Context, hash string, query string) + Get(ctx context.Context, hash string) (string, bool) +} + type Config struct { cacheSize int upgrader websocket.Upgrader @@ -61,7 +66,7 @@ type Config struct { connectionKeepAlivePingInterval time.Duration uploadMaxMemory int64 uploadMaxSize int64 - apqCacheSize int + apqCache PersistedQueryCache } func (c *Config) newRequestContext(es graphql.ExecutableSchema, doc *ast.QueryDocument, op *ast.OperationDefinition, query string, variables map[string]interface{}) *graphql.RequestContext { @@ -303,11 +308,10 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option { } } -// APQCacheSize sets the maximum size of the automatic persisted query cache. -// If size is less than or equal to 0, the cache is disabled. -func APQCacheSize(size int) Option { +// Add cache that will hold queries for automatic persisted queries (APQ) +func EnablePersistedQueryCache(cache PersistedQueryCache) Option { return func(cfg *Config) { - cfg.apqCacheSize = size + cfg.apqCache = cache } } @@ -353,22 +357,10 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc cfg.tracer = &graphql.NopTracer{} } - var apqCache *lru.Cache - if cfg.apqCacheSize > 0 { - var err error - apqCache, err = lru.New(cfg.apqCacheSize) - if err != nil { - // An error is only returned for non-positive cache size - // and we already checked for that. - panic("unexpected error creating apq cache: " + err.Error()) - } - } - handler := &graphqlHandler{ cfg: cfg, cache: cache, exec: exec, - apqCache: apqCache, } return handler.ServeHTTP @@ -380,7 +372,6 @@ type graphqlHandler struct { cfg *Config cache *lru.Cache exec graphql.ExecutableSchema - apqCache *lru.Cache } func computeQueryHash(query string) string { @@ -461,32 +452,34 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ctx := r.Context() var queryHash string - apq := reqParams.Extensions != nil && reqParams.Extensions.PQ != nil + apqRegister := false + apq := reqParams.Extensions != nil && reqParams.Extensions.PersistedQuery != nil if apq { // client has enabled apq - queryHash = reqParams.Extensions.PQ.Sha256 - if gh.apqCache == nil { + queryHash = reqParams.Extensions.PersistedQuery.Sha256 + if gh.cfg.apqCache == nil { // server has disabled apq sendErrorf(w, http.StatusOK, errPersistedQueryNotSupported) return } - if reqParams.Extensions.PQ.Version != 1 { + if reqParams.Extensions.PersistedQuery.Version != 1 { sendErrorf(w, http.StatusOK, "Unsupported persisted query version") return } if reqParams.Query == "" { // client sent optimistic query hash without query string - query, ok := gh.apqCache.Get(queryHash) + query, ok := gh.cfg.apqCache.Get(ctx, queryHash) if !ok { sendErrorf(w, http.StatusOK, errPersistedQueryNotFound) return } - reqParams.Query = query.(string) + reqParams.Query = query } else { if computeQueryHash(reqParams.Query) != queryHash { sendErrorf(w, http.StatusOK, "provided sha does not match query") return } + apqRegister = true } } else if reqParams.Query == "" { sendErrorf(w, http.StatusUnprocessableEntity, "Must provide query string") @@ -547,9 +540,9 @@ func (gh *graphqlHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - if apq && gh.apqCache != nil { + if apqRegister && gh.cfg.apqCache != nil { // Add to persisted query cache - gh.apqCache.Add(queryHash, reqParams.Query) + gh.cfg.apqCache.Add(ctx, queryHash, reqParams.Query) } switch op.Operation { diff --git a/handler/graphql_test.go b/handler/graphql_test.go index 93a257706de..bfcc11082c2 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -15,6 +15,7 @@ import ( "testing" "github.com/99designs/gqlgen/graphql" + lru "github.com/hashicorp/golang-lru" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/vektah/gqlparser/ast" @@ -765,8 +766,30 @@ func TestBytesRead(t *testing.T) { }) } +type memoryPersistedQueryCache struct { + cache *lru.Cache +} + +func newMemoryPersistedQueryCache(size int) (*memoryPersistedQueryCache, error) { + cache, err := lru.New(size) + return &memoryPersistedQueryCache{cache: cache}, err +} + +func (c *memoryPersistedQueryCache) Add(ctx context.Context, hash string, query string) { + c.cache.Add(hash, query) +} + +func (c *memoryPersistedQueryCache) Get(ctx context.Context, hash string) (string, bool) { + val, ok := c.cache.Get(hash) + if !ok { + return "", ok + } + return val.(string), ok +} func TestAutomaticPersistedQuery(t *testing.T) { - h := GraphQL(&executableSchemaStub{}, APQCacheSize(1000)) + cache, err := newMemoryPersistedQueryCache(1000) + require.NoError(t, err) + h := GraphQL(&executableSchemaStub{}, EnablePersistedQueryCache(cache)) t.Run("automatic persisted query POST", func(t *testing.T) { // normal queries should be unaffected resp := doRequest(h, "POST", "/graphql", `{"query":"{ me { name } }"}`) From 9873d998b54009721c81b3c13b23f975463aaf02 Mon Sep 17 00:00:00 2001 From: Igor Ivanov Date: Wed, 12 Jun 2019 11:44:56 +0200 Subject: [PATCH 08/30] Add APQ documentation with example --- docs/content/reference/apq.md | 77 +++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 docs/content/reference/apq.md diff --git a/docs/content/reference/apq.md b/docs/content/reference/apq.md new file mode 100644 index 00000000000..1c978db4a4b --- /dev/null +++ b/docs/content/reference/apq.md @@ -0,0 +1,77 @@ +--- +title: "Automatic persisted queries" +description: +linkTitle: "APQ" +menu: { main: { parent: 'reference' } } +--- + +When you work with GraphQL by default your queries are transferred with every request. That can waste significant +bandwidth. To avoid that you can use Automatic Persisted Queries (APQ). + +With APQ you send only query hash to the server. If hash is not found on a server then client makes a second request +to register query hash with original query on a server. + +## Usage + +In order to enable Automatic Persisted Queries you need to change your client. For more information see +[Automatic Persisted Queries Link](https://github.com/apollographql/apollo-link-persisted-queries) documentation. + +For the server you need to implement `PersistedQueryCache` interface and pass instance to +`handler.EnablePersistedQueryCache` option. + +See example using [go-redis](github.com/go-redis/redis) package below: +```go +import ( + "context" + "time" + + "github.com/go-redis/redis" + "github.com/pkg/errors" +) + +type Cache struct { + client redis.UniversalClient + ttl time.Duration +} + +const apqPrefix = "apq:" + +func NewCache(redisAddress string, password string, ttl time.Duration) (*Cache, error) { + client := redis.NewClient(&redis.Options{ + Addr: redisAddress, + }) + + err := client.Ping().Err() + if err != nil { + return nil, errors.WithStack(err) + } + + return &Cache{client: client, ttl: ttl}, nil +} + +func (c *Cache) Add(ctx context.Context, hash string, query string) { + c.client.Set(apqPrefix + hash, query, c.ttl) +} + +func (c *Cache) Get(ctx context.Context, hash string) (string, bool) { + s, err := c.client.Get(apqPrefix + hash).Result() + if err != nil { + return "", false + } + return s, true +} + +func main() { + cache, err := NewCache(cfg.RedisAddress, 24*time.Hour) + if err != nil { + log.Fatalf("cannot create APQ redis cache: %v", err) + } + + c := Config{ Resolvers: &resolvers{} } + gqlHandler := handler.GraphQL( + blog.NewExecutableSchema(c), + handler.EnablePersistedQueryCache(cache), + ) + http.Handle("/query", gqlHandler) +} +``` From 8fcc186817974f99060f0f815dd3935876607bf0 Mon Sep 17 00:00:00 2001 From: DBL-Lee Date: Wed, 12 Jun 2019 15:13:27 -0700 Subject: [PATCH 09/30] format --- handler/graphql.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/handler/graphql.go b/handler/graphql.go index 67420950588..0c05fd4db13 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -358,9 +358,9 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc } handler := &graphqlHandler{ - cfg: cfg, - cache: cache, - exec: exec, + cfg: cfg, + cache: cache, + exec: exec, } return handler.ServeHTTP @@ -369,9 +369,9 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc var _ http.Handler = (*graphqlHandler)(nil) type graphqlHandler struct { - cfg *Config - cache *lru.Cache - exec graphql.ExecutableSchema + cfg *Config + cache *lru.Cache + exec graphql.ExecutableSchema } func computeQueryHash(query string) string { From 3eec887a69508b9e431d384a9adae8ee53d63b97 Mon Sep 17 00:00:00 2001 From: asamusev Date: Fri, 14 Jun 2019 08:30:06 +0300 Subject: [PATCH 10/30] add Execute QUERY/MUTATION/SUBSCRIPTION Directives --- codegen/data.go | 34 ++++++---- codegen/directive.go | 30 ++++++++- codegen/generated!.gotpl | 128 +++++++++++++++++++++++++++++++++++- example/todo/schema.graphql | 1 + 4 files changed, 175 insertions(+), 18 deletions(-) diff --git a/codegen/data.go b/codegen/data.go index f2ea70b4a43..ca32707067a 100644 --- a/codegen/data.go +++ b/codegen/data.go @@ -12,15 +12,18 @@ import ( // Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement // resolvers or directives automatically (eg grpc, validation) type Data struct { - Config *config.Config - Schema *ast.Schema - SchemaStr map[string]string - Directives map[string]*Directive - Objects Objects - Inputs Objects - Interfaces map[string]*Interface - ReferencedTypes map[string]*config.TypeReference - ComplexityRoots map[string]*Object + Config *config.Config + Schema *ast.Schema + SchemaStr map[string]string + Directives DirectiveList + QueryDirectives DirectiveList + MutationDirectives DirectiveList + SubscriptionDirectives DirectiveList + Objects Objects + Inputs Objects + Interfaces map[string]*Interface + ReferencedTypes map[string]*config.TypeReference + ComplexityRoots map[string]*Object QueryRoot *Object MutationRoot *Object @@ -71,11 +74,14 @@ func BuildData(cfg *config.Config) (*Data, error) { } s := Data{ - Config: cfg, - Directives: dataDirectives, - Schema: b.Schema, - SchemaStr: b.SchemaStr, - Interfaces: map[string]*Interface{}, + Config: cfg, + Directives: dataDirectives, + QueryDirectives: locationDirectives(dataDirectives, ast.LocationQuery), + MutationDirectives: locationDirectives(dataDirectives, ast.LocationMutation), + SubscriptionDirectives: locationDirectives(dataDirectives, ast.LocationSubscription), + Schema: b.Schema, + SchemaStr: b.SchemaStr, + Interfaces: map[string]*Interface{}, } for _, schemaType := range b.Schema.Types { diff --git a/codegen/directive.go b/codegen/directive.go index 5a27e8ace71..dccf914d36b 100644 --- a/codegen/directive.go +++ b/codegen/directive.go @@ -10,12 +10,35 @@ import ( "github.com/vektah/gqlparser/ast" ) +type DirectiveList map[string]*Directive + type Directive struct { + *ast.DirectiveDefinition Name string Args []*FieldArgument Builtin bool } +func (d *Directive) IsLocation(location ast.DirectiveLocation) bool { + for _, l := range d.Locations { + if l == location { + return true + } + } + + return false +} + +func locationDirectives(directives DirectiveList, location ast.DirectiveLocation) map[string]*Directive { + mDirectives := make(map[string]*Directive) + for name, d := range directives { + if d.IsLocation(location) { + mDirectives[name] = d + } + } + return mDirectives +} + func (b *builder) buildDirectives() (map[string]*Directive, error) { directives := make(map[string]*Directive, len(b.Schema.Directives)) @@ -53,9 +76,10 @@ func (b *builder) buildDirectives() (map[string]*Directive, error) { } directives[name] = &Directive{ - Name: name, - Args: args, - Builtin: builtin, + DirectiveDefinition: dir, + Name: name, + Args: args, + Builtin: builtin, } } diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 5753f1d1360..9d8915c8d77 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -117,7 +117,11 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { + {{ if .MutationDirectives -}} + data := ec._{{.QueryRoot.Name}}Middleware(ctx, op) + {{- else -}} data := ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet) + {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -138,7 +142,11 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { + {{ if .MutationDirectives -}} + data := ec._{{.MutationRoot.Name}}Middleware(ctx, op) + {{- else -}} data := ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet) + {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -158,7 +166,11 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe {{- if .SubscriptionRoot }} ec := executionContext{graphql.GetRequestContext(ctx), e} - next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet) + {{ if .MutationDirectives -}} + next := ec._{{.SubscriptionRoot.Name}}Middleware(ctx, op) + {{- else -}} + next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet) + {{- end }} if ec.Errors != nil { return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) } @@ -196,6 +208,120 @@ type executionContext struct { *executableSchema } +{{ if and .QueryDirectives .QueryRoot }} +func (ec *executionContext) _{{.QueryRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { + + next := func(ctx context.Context) (interface{}, error){ + return ec._{{.QueryRoot.Name}}(ctx, obj.SelectionSet),nil + } + for _, d := range obj.Directives { + switch d.Name { + {{- range $directive := .QueryDirectives }} + case "{{$directive.Name}}": + {{- if $directive.Args }} + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + {{- end }} + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) + } + {{- end }} + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null +} +{{end}} + +{{ if and .SubscriptionDirectives .SubscriptionRoot }} +func (ec *executionContext) _{{.SubscriptionRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { + + next := func(ctx context.Context) (interface{}, error){ + return ec._{{.SubscriptionRoot.Name}}(ctx, obj.SelectionSet),nil + } + for _, d := range obj.Directives { + switch d.Name { + {{- range $directive := .SubscriptionDirectives }} + case "{{$directive.Name}}": + {{- if $directive.Args }} + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + {{- end }} + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) + } + {{- end }} + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null +} +{{end}} + +{{ if and .MutationDirectives .MutationRoot }} +func (ec *executionContext) _{{.MutationRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { + + next := func(ctx context.Context) (interface{}, error){ + return ec._{{.MutationRoot.Name}}(ctx, obj.SelectionSet),nil + } + for _, d := range obj.Directives { + switch d.Name { + {{- range $directive := .MutationDirectives }} + case "{{$directive.Name}}": + {{- if $directive.Args }} + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + {{- end }} + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) + } + {{- end }} + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null +} +{{end}} + func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { diff --git a/example/todo/schema.graphql b/example/todo/schema.graphql index 8adac85147e..41a4bd1aeee 100644 --- a/example/todo/schema.graphql +++ b/example/todo/schema.graphql @@ -32,6 +32,7 @@ scalar Map "Prevents access to a field if the user doesnt have the matching role" directive @hasRole(role: Role!) on FIELD_DEFINITION +directive @user(id: ID!) on MUTATION | QUERY enum Role { ADMIN From 32462d0f1c2cd6b9f94639ee83da288d25219eae Mon Sep 17 00:00:00 2001 From: asamusev Date: Fri, 14 Jun 2019 09:00:01 +0300 Subject: [PATCH 11/30] update example todo add directive with location QUERY and MUTATION --- example/todo/generated.go | 98 ++++++++++++++++++++++++++++++++++++++- example/todo/todo.go | 14 +++++- example/todo/todo_test.go | 12 +++++ 3 files changed, 120 insertions(+), 4 deletions(-) diff --git a/example/todo/generated.go b/example/todo/generated.go index 52a22e61ee9..29681516cbd 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -40,6 +40,8 @@ type ResolverRoot interface { type DirectiveRoot struct { HasRole func(ctx context.Context, obj interface{}, next graphql.Resolver, role Role) (res interface{}, err error) + + User func(ctx context.Context, obj interface{}, next graphql.Resolver, id int) (res interface{}, err error) } type ComplexityRoot struct { @@ -165,7 +167,7 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._MyQuery(ctx, op.SelectionSet) + data := ec._MyQueryMiddleware(ctx, op) var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -182,7 +184,7 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._MyMutation(ctx, op.SelectionSet) + data := ec._MyMutationMiddleware(ctx, op) var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -204,6 +206,70 @@ type executionContext struct { *executableSchema } +func (ec *executionContext) _MyQueryMiddleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { + + next := func(ctx context.Context) (interface{}, error) { + return ec._MyQuery(ctx, obj.SelectionSet), nil + } + for _, d := range obj.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["id"].(int)) + } + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null +} + +func (ec *executionContext) _MyMutationMiddleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { + + next := func(ctx context.Context) (interface{}, error) { + return ec._MyMutation(ctx, obj.SelectionSet), nil + } + for _, d := range obj.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["id"].(int)) + } + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null +} + func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { @@ -227,6 +293,19 @@ func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{} return ec.directives.HasRole(ctx, obj, n, args["role"].(Role)) } } + case "user": + if ec.directives.User != nil { + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return nil + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["id"].(int)) + } + } } } res, err := ec.ResolverMiddleware(ctx, next) @@ -286,6 +365,7 @@ scalar Map "Prevents access to a field if the user doesnt have the matching role" directive @hasRole(role: Role!) on FIELD_DEFINITION +directive @user(id: ID!) on MUTATION | QUERY enum Role { ADMIN @@ -312,6 +392,20 @@ func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[st return args, nil } +func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 int + if tmp, ok := rawArgs["id"]; ok { + arg0, err = ec.unmarshalNID2int(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} diff --git a/example/todo/todo.go b/example/todo/todo.go index 5c2fa129dc8..de106f0cbc7 100644 --- a/example/todo/todo.go +++ b/example/todo/todo.go @@ -15,13 +15,20 @@ import ( var you = &User{ID: 1, Name: "You"} var them = &User{ID: 2, Name: "Them"} +func getUserId(ctx context.Context) int { + if id, ok := ctx.Value("userId").(int); ok { + return id + } + return you.ID +} + func New() Config { c := Config{ Resolvers: &resolvers{ todos: []*Todo{ {ID: 1, Text: "A todo not to forget", Done: false, owner: you}, {ID: 2, Text: "This is the most important", Done: false, owner: you}, - {ID: 3, Text: "Somebody else's todo", Done: true, owner: them}, + {ID: 3, Text: "Somebody else's todo", Done: false, owner: them}, {ID: 4, Text: "Please do this or else", Done: false, owner: you}, }, lastID: 4, @@ -38,13 +45,16 @@ func New() Config { return nil, fmt.Errorf("obj cant be owned") } - if ownable.Owner().ID != you.ID { + if ownable.Owner().ID != getUserId(ctx) { return nil, fmt.Errorf("you dont own that") } } return next(ctx) } + c.Directives.User = func(ctx context.Context, obj interface{}, next graphql.Resolver, id int) (interface{}, error) { + return next(context.WithValue(ctx, "userId", id)) + } return c } diff --git a/example/todo/todo_test.go b/example/todo/todo_test.go index 2b3296d72a8..7a06c7977be 100644 --- a/example/todo/todo_test.go +++ b/example/todo/todo_test.go @@ -55,6 +55,18 @@ func TestTodo(t *testing.T) { require.Equal(t, "Very important", resp.UpdateTodo.Text) }) + t.Run("update the todo status by user id", func(t *testing.T) { + var resp struct { + UpdateTodo struct { + Text string + Done bool + } + } + c.MustPost(`mutation @user(id:2){ updateTodo(id: 3, changes:{done:true}) { text, done } }`, &resp) + + require.Equal(t, "Somebody else's todo", resp.UpdateTodo.Text) + }) + t.Run("select with alias", func(t *testing.T) { var resp struct { A struct{ Text string } From f32571ee002479dc07c3b81548d15fdc1169bfa6 Mon Sep 17 00:00:00 2001 From: asamusev Date: Fri, 14 Jun 2019 09:36:15 +0300 Subject: [PATCH 12/30] add SUBSCRIPTION Directive --- codegen/generated!.gotpl | 18 ++++++--- example/chat/chat_test.go | 5 ++- example/chat/generated.go | 75 ++++++++++++++++++++++++++++++++++++- example/chat/resolvers.go | 54 ++++++++++++++++++++++---- example/chat/schema.graphql | 2 + 5 files changed, 138 insertions(+), 16 deletions(-) diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 9d8915c8d77..0117b952ffb 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -166,7 +166,7 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe {{- if .SubscriptionRoot }} ec := executionContext{graphql.GetRequestContext(ctx), e} - {{ if .MutationDirectives -}} + {{ if .SubscriptionDirectives -}} next := ec._{{.SubscriptionRoot.Name}}Middleware(ctx, op) {{- else -}} next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet) @@ -247,7 +247,7 @@ func (ec *executionContext) _{{.QueryRoot.Name}}Middleware(ctx context.Context, {{end}} {{ if and .SubscriptionDirectives .SubscriptionRoot }} -func (ec *executionContext) _{{.SubscriptionRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { +func (ec *executionContext) _{{.SubscriptionRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) func() graphql.Marshaler { next := func(ctx context.Context) (interface{}, error){ return ec._{{.SubscriptionRoot.Name}}(ctx, obj.SelectionSet),nil @@ -261,7 +261,9 @@ func (ec *executionContext) _{{.SubscriptionRoot.Name}}Middleware(ctx context.Co args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) if err != nil { ec.Error(ctx, err) - return graphql.Null + return func() graphql.Marshaler { + return graphql.Null + } } {{- end }} n := next @@ -274,13 +276,17 @@ func (ec *executionContext) _{{.SubscriptionRoot.Name}}Middleware(ctx context.Co tmp, err := next(ctx) if err != nil { ec.Error(ctx, err) - return graphql.Null + return func() graphql.Marshaler { + return graphql.Null + } } - if data, ok := tmp.(graphql.Marshaler); ok { + if data, ok := tmp.(func() graphql.Marshaler); ok { return data } ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return graphql.Null + return func() graphql.Marshaler { + return graphql.Null + } } {{end}} diff --git a/example/chat/chat_test.go b/example/chat/chat_test.go index a4245f4862d..23c6673ef66 100644 --- a/example/chat/chat_test.go +++ b/example/chat/chat_test.go @@ -15,7 +15,7 @@ func TestChatSubscriptions(t *testing.T) { srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(New()))) c := client.New(srv.URL) - sub := c.Websocket(`subscription { messageAdded(roomName:"#gophers") { text createdBy } }`) + sub := c.Websocket(`subscription @user(username:"vektah") { messageAdded(roomName:"#gophers") { text createdBy } }`) defer sub.Close() go func() { @@ -23,7 +23,8 @@ func TestChatSubscriptions(t *testing.T) { time.Sleep(10 * time.Millisecond) err := c.Post(`mutation { a:post(text:"Hello!", roomName:"#gophers", username:"vektah") { id } - b:post(text:"Whats up?", roomName:"#gophers", username:"vektah") { id } + b:post(text:"Hello Vektah!", roomName:"#gophers", username:"andrey") { id } + c:post(text:"Whats up?", roomName:"#gophers", username:"vektah") { id } }`, &resp) assert.NoError(t, err) }() diff --git a/example/chat/generated.go b/example/chat/generated.go index f13879d03cc..15ffd28ce48 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -41,6 +41,7 @@ type ResolverRoot interface { } type DirectiveRoot struct { + User func(ctx context.Context, obj interface{}, next graphql.Resolver, username string) (res interface{}, err error) } type ComplexityRoot struct { @@ -213,7 +214,7 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} - next := ec._Subscription(ctx, op.SelectionSet) + next := ec._SubscriptionMiddleware(ctx, op) if ec.Errors != nil { return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) } @@ -248,6 +249,44 @@ type executionContext struct { *executableSchema } +func (ec *executionContext) _SubscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition) func() graphql.Marshaler { + + next := func(ctx context.Context) (interface{}, error) { + return ec._Subscription(ctx, obj.SelectionSet), nil + } + for _, d := range obj.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return func() graphql.Marshaler { + return graphql.Null + } + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["username"].(string)) + } + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return func() graphql.Marshaler { + return graphql.Null + } + } + if data, ok := tmp.(func() graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return func() graphql.Marshaler { + return graphql.Null + } +} + func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { @@ -255,6 +294,24 @@ func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{} ret = nil } }() + rctx := graphql.GetResolverContext(ctx) + for _, d := range rctx.Field.Definition.Directives { + switch d.Name { + case "user": + if ec.directives.User != nil { + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return nil + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["username"].(string)) + } + } + } + } res, err := ec.ResolverMiddleware(ctx, next) if err != nil { ec.Error(ctx, err) @@ -303,6 +360,8 @@ type Subscription { } scalar Time + +directive @user(username: String!) on SUBSCRIPTION `}, ) @@ -310,6 +369,20 @@ scalar Time // region ***************************** args.gotpl ***************************** +func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["username"]; ok { + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["username"] = arg0 + return args, nil +} + func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} diff --git a/example/chat/resolvers.go b/example/chat/resolvers.go index 5c0de7b0602..023b88f664e 100644 --- a/example/chat/resolvers.go +++ b/example/chat/resolvers.go @@ -3,10 +3,12 @@ package chat import ( - context "context" + "context" "math/rand" "sync" "time" + + "github.com/99designs/gqlgen/graphql" ) type resolver struct { @@ -31,13 +33,28 @@ func New() Config { Resolvers: &resolver{ Rooms: map[string]*Chatroom{}, }, + Directives: DirectiveRoot{ + User: func(ctx context.Context, obj interface{}, next graphql.Resolver, username string) (res interface{}, err error) { + return next(context.WithValue(ctx, "username", username)) + }, + }, + } +} + +func getUsername(ctx context.Context) string { + if username, ok := ctx.Value("username").(string); ok { + return username } + return "" } type Chatroom struct { Name string Messages []Message - Observers map[string]chan *Message + Observers map[string]struct { + Username string + Message chan *Message + } } type mutationResolver struct{ *resolver } @@ -46,7 +63,13 @@ func (r *mutationResolver) Post(ctx context.Context, text string, username strin r.mu.Lock() room := r.Rooms[roomName] if room == nil { - room = &Chatroom{Name: roomName, Observers: map[string]chan *Message{}} + room = &Chatroom{ + Name: roomName, + Observers: map[string]struct { + Username string + Message chan *Message + }{}, + } r.Rooms[roomName] = room } r.mu.Unlock() @@ -61,7 +84,9 @@ func (r *mutationResolver) Post(ctx context.Context, text string, username strin room.Messages = append(room.Messages, message) r.mu.Lock() for _, observer := range room.Observers { - observer <- &message + if observer.Username == "" || observer.Username == message.CreatedBy { + observer.Message <- &message + } } r.mu.Unlock() return &message, nil @@ -73,7 +98,13 @@ func (r *queryResolver) Room(ctx context.Context, name string) (*Chatroom, error r.mu.Lock() room := r.Rooms[name] if room == nil { - room = &Chatroom{Name: name, Observers: map[string]chan *Message{}} + room = &Chatroom{ + Name: name, + Observers: map[string]struct { + Username string + Message chan *Message + }{}, + } r.Rooms[name] = room } r.mu.Unlock() @@ -87,7 +118,13 @@ func (r *subscriptionResolver) MessageAdded(ctx context.Context, roomName string r.mu.Lock() room := r.Rooms[roomName] if room == nil { - room = &Chatroom{Name: roomName, Observers: map[string]chan *Message{}} + room = &Chatroom{ + Name: roomName, + Observers: map[string]struct { + Username string + Message chan *Message + }{}, + } r.Rooms[roomName] = room } r.mu.Unlock() @@ -103,7 +140,10 @@ func (r *subscriptionResolver) MessageAdded(ctx context.Context, roomName string }() r.mu.Lock() - room.Observers[id] = events + room.Observers[id] = struct { + Username string + Message chan *Message + }{Username: getUsername(ctx), Message: events} r.mu.Unlock() return events, nil diff --git a/example/chat/schema.graphql b/example/chat/schema.graphql index 85a46768edf..18bfcae121b 100644 --- a/example/chat/schema.graphql +++ b/example/chat/schema.graphql @@ -23,3 +23,5 @@ type Subscription { } scalar Time + +directive @user(username: String!) on SUBSCRIPTION From cfdbc39ac69a08450ebf70dfaa40f4b86225d0a2 Mon Sep 17 00:00:00 2001 From: asamusev Date: Fri, 14 Jun 2019 09:45:56 +0300 Subject: [PATCH 13/30] update QueryDirectives --- codegen/generated!.gotpl | 2 +- example/todo/todo.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 0117b952ffb..ce040ef18b0 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -117,7 +117,7 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - {{ if .MutationDirectives -}} + {{ if .QueryDirectives -}} data := ec._{{.QueryRoot.Name}}Middleware(ctx, op) {{- else -}} data := ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet) diff --git a/example/todo/todo.go b/example/todo/todo.go index de106f0cbc7..fdacb112d67 100644 --- a/example/todo/todo.go +++ b/example/todo/todo.go @@ -28,7 +28,7 @@ func New() Config { todos: []*Todo{ {ID: 1, Text: "A todo not to forget", Done: false, owner: you}, {ID: 2, Text: "This is the most important", Done: false, owner: you}, - {ID: 3, Text: "Somebody else's todo", Done: false, owner: them}, + {ID: 3, Text: "Somebody else's todo", Done: true, owner: them}, {ID: 4, Text: "Please do this or else", Done: false, owner: you}, }, lastID: 4, From c5acbead96b3c2c307809b8dd37af9dda610a84b Mon Sep 17 00:00:00 2001 From: Fabian Ezequiel Gallina Date: Sun, 26 May 2019 20:06:12 -0300 Subject: [PATCH 14/30] resolvergen: use the resolver type as base name for dependent types The template was outputing invalid code since the resolver type was not used in places like the embedding at {query,mutation}Resolver. This change also ensures that objects like {query,mutation}Resolver also use the user provided type name as suffix. Here's the resulting diff on the code generation with `type: GeneratedResolver` in the resolver config: ``` diff -u resolver.go resolvernew.go --- resolver.go 2019-05-26 20:04:15.361969755 -0300 +++ resolvernew.go 2019-05-26 20:04:54.170737786 -0300 @@ -7,20 +7,20 @@ type GeneratedResolver struct{} func (r *GeneratedResolver) Mutation() MutationResolver { - return &mutationResolver{r} + return &mutationGeneratedResolver{r} } func (r *GeneratedResolver) Query() QueryResolver { - return &queryResolver{r} + return &queryGeneratedResolver{r} } -type mutationResolver struct{ *Resolver } +type mutationGeneratedResolver struct{ *GeneratedResolver } -func (r *mutationResolver) CreateTodo(ctx context.Context, input NewTodo) (*Todo, error) { +func (r *mutationGeneratedResolver) CreateTodo(ctx context.Context, input NewTodo) (*Todo, error) { panic("not implemented") } -type queryResolver struct{ *Resolver } +type queryGeneratedResolver struct{ *GeneratedResolver } -func (r *queryResolver) Todos(ctx context.Context) ([]*Todo, error) { +func (r *queryGeneratedResolver) Todos(ctx context.Context) ([]*Todo, error) { panic("not implemented") } ``` --- plugin/resolvergen/resolver.go | 1 + plugin/resolvergen/resolver.gotpl | 6 +- plugin/resolvergen/resolver_test.go | 163 ++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 3 deletions(-) create mode 100644 plugin/resolvergen/resolver_test.go diff --git a/plugin/resolvergen/resolver.go b/plugin/resolvergen/resolver.go index 00a6d5c9d42..6785c77c45f 100644 --- a/plugin/resolvergen/resolver.go +++ b/plugin/resolvergen/resolver.go @@ -19,6 +19,7 @@ type Plugin struct{} var _ plugin.CodeGenerator = &Plugin{} func (m *Plugin) Name() string { + // TODO: typo, should be resolvergen return "resovlergen" } func (m *Plugin) GenerateCode(data *codegen.Data) error { diff --git a/plugin/resolvergen/resolver.gotpl b/plugin/resolvergen/resolver.gotpl index 7d95e6903ce..66d6efac25e 100644 --- a/plugin/resolvergen/resolver.gotpl +++ b/plugin/resolvergen/resolver.gotpl @@ -20,18 +20,18 @@ type {{.ResolverType}} struct {} {{ range $object := .Objects -}} {{- if $object.HasResolvers -}} func (r *{{$.ResolverType}}) {{$object.Name}}() {{ $object.ResolverInterface | ref }} { - return &{{lcFirst $object.Name}}Resolver{r} + return &{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}{r} } {{ end -}} {{ end }} {{ range $object := .Objects -}} {{- if $object.HasResolvers -}} - type {{lcFirst $object.Name}}Resolver struct { *Resolver } + type {{lcFirst $object.Name}}{{ucFirst $.ResolverType}} struct { *{{$.ResolverType}} } {{ range $field := $object.Fields -}} {{- if $field.IsResolver -}} - func (r *{{lcFirst $object.Name}}Resolver) {{$field.GoFieldName}}{{ $field.ShortResolverDeclaration }} { + func (r *{{lcFirst $object.Name}}{{ucFirst $.ResolverType}}) {{$field.GoFieldName}}{{ $field.ShortResolverDeclaration }} { panic("not implemented") } {{ end -}} diff --git a/plugin/resolvergen/resolver_test.go b/plugin/resolvergen/resolver_test.go new file mode 100644 index 00000000000..b100f7cc74c --- /dev/null +++ b/plugin/resolvergen/resolver_test.go @@ -0,0 +1,163 @@ +package resolvergen + +import ( + "fmt" + "go/types" + "io/ioutil" + "os" + "path/filepath" + "strings" + "testing" + "unicode" + + "github.com/99designs/gqlgen/codegen" + "github.com/99designs/gqlgen/codegen/config" + "github.com/vektah/gqlparser/ast" +) + +func TestPlugin_Name(t *testing.T) { + t.Run("test plugin name", func(t *testing.T) { + m := &Plugin{} + if got, want := m.Name(), "resovlergen"; got != want { + t.Errorf("Plugin.Name() = %v, want %v", got, want) + } + }) +} + +// Types for testing code generation, both Mutation and +// MutationResolver must implement types.Type. +type Mutation struct{} + +func (m *Mutation) Underlying() types.Type { + return m +} + +func (m *Mutation) String() string { + return "Mutation" +} + +type MutationResolver struct{} + +func (m *MutationResolver) Underlying() types.Type { + return m +} + +func (m *MutationResolver) String() string { + return "MutationResolver" +} + +func TestPlugin_GenerateCode(t *testing.T) { + makeData := func(cfg config.PackageConfig) *codegen.Data { + m := &Mutation{} + obj := &codegen.Object{ + Definition: &ast.Definition{ + Name: fmt.Sprint(m), + }, + Root: true, + Fields: []*codegen.Field{ + &codegen.Field{ + IsResolver: true, + GoFieldName: "Name", + TypeReference: &config.TypeReference{ + GO: m, + }, + }, + }, + ResolverInterface: &MutationResolver{}, + } + obj.Fields[0].Object = obj + return &codegen.Data{ + Config: &config.Config{ + Resolver: cfg, + }, + Objects: codegen.Objects{obj}, + } + } + + t.Run("renders expected contents", func(t *testing.T) { + m := &Plugin{} + + // use a temp dir to ensure generated file uniqueness, + // since if a file already exists it won't be + // overwritten. + tempDir, err := ioutil.TempDir("", "resolvergen-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tempDir) + filename := filepath.Join(tempDir, "generated.go") + + data := makeData(config.PackageConfig{ + Filename: filename, + Package: "customresolver", + Type: "CustomResolverType", + }) + if err := m.GenerateCode(data); err != nil { + t.Fatal(err) + } + + byteContents, err := ioutil.ReadFile(filename) + if err != nil { + t.Fatal(err) + } + contents := string(byteContents) + + want := "package customresolver" + if !strings.Contains(contents, want) { + t.Fatalf("expected package name not found: want = %q\n%s", want, contents) + } + + // Skip all white-space chars after start and want + // length. Useful to jump to next non-white character + // contents for generated code assertions. + skipWhitespace := func(start int, want string) int { + return start + len(want) + strings.IndexFunc( + string(contents[start+len(want):]), + func(r rune) bool { return !unicode.IsSpace(r) }, + ) + } + // Check if want begins at the given start point. + lookingAt := func(start int, want string) bool { + return strings.Index(string(contents[start:]), want) == 0 + } + + // Assert Mutation method contents for *CustomResolverType + want = "func (r *CustomResolverType) Mutation() MutationResolver {" + start := strings.Index(contents, want) + if start == -1 { + t.Fatalf("mutation method for custom resolver not found: want = %q\n%s", want, contents) + } + start = skipWhitespace(start, want) + want = "return &mutationCustomResolverType{r}" + if !lookingAt(start, want) { + t.Fatalf("unexpected return on mutation method for custom resolver: want = %q\n%s", want, contents) + } + start = skipWhitespace(start, want) + want = "}" + if !lookingAt(start, want) { + t.Fatalf("unexpected contents on mutation method for custom resolver: want = %q\n%s", want, contents) + } + + want = "type mutationCustomResolverType struct{ *CustomResolverType }" + if !strings.Contains(contents, want) { + t.Fatalf("expected embedded resolver type struct not found: want = %q\n%s", want, contents) + } + + // Assert Name method contents for *mutationCustomResolverType + want = "func (r *mutationCustomResolverType) Name(ctx context.Context) (Mutation, error) {" + start = strings.Index(contents, want) + if start == -1 { + t.Fatalf("Name method for mutation custom resolver type not found: want = %q\n%s", want, contents) + } + start = skipWhitespace(start, want) + want = `panic("not implemented")` + if !lookingAt(start, want) { + t.Fatalf("unexpected Name method contents for mutation custom resolver type: want = %q\n%s", want, contents) + } + start = skipWhitespace(start, want) + want = "}" + if !lookingAt(start, want) { + t.Fatalf("unexpected Name method contents for mutation custom resolver type: want = %q\n%s", want, contents) + } + }) +} From e6d791a9b83827bb5054b023baf100c5866d54bd Mon Sep 17 00:00:00 2001 From: Eddy Date: Mon, 17 Jun 2019 15:47:42 +1000 Subject: [PATCH 15/30] Add websocketOnConnectFunc as a config that can be used to validate websocket init requests --- handler/graphql.go | 9 +++++++ handler/websocket.go | 11 ++++++++- handler/websocket_test.go | 50 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/handler/graphql.go b/handler/graphql.go index a22542225fc..5b963641d71 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -40,6 +40,7 @@ type Config struct { tracer graphql.Tracer complexityLimit int complexityLimitFunc graphql.ComplexityLimitFunc + websocketOnInitFunc func(ctx context.Context, initPayload InitPayload) bool disableIntrospection bool connectionKeepAlivePingInterval time.Duration uploadMaxMemory int64 @@ -250,6 +251,14 @@ func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) { tw.tracer1.EndOperationExecution(ctx) } +// WebsocketOnInitFunc is called when the server receives connection init message from the client. +// This can be used to check initial payload to see whether to accept the websocket connection. +func WebsocketOnInitFunc(websocketOnInitFunc func(ctx context.Context, initPayload InitPayload) bool) Option { + return func(cfg *Config) { + cfg.websocketOnInitFunc = websocketOnInitFunc + } +} + // CacheSize sets the maximum size of the query cache. // If size is less than or equal to 0, the cache is disabled. func CacheSize(size int) Option { diff --git a/handler/websocket.go b/handler/websocket.go index 58f38e5d48d..0747e63bc72 100644 --- a/handler/websocket.go +++ b/handler/websocket.go @@ -12,7 +12,7 @@ import ( "github.com/99designs/gqlgen/graphql" "github.com/gorilla/websocket" - "github.com/hashicorp/golang-lru" + lru "github.com/hashicorp/golang-lru" "github.com/vektah/gqlparser" "github.com/vektah/gqlparser/ast" "github.com/vektah/gqlparser/gqlerror" @@ -94,6 +94,15 @@ func (c *wsConnection) init() bool { } } + if c.cfg.websocketOnInitFunc != nil { + isValidPayload := c.cfg.websocketOnInitFunc(c.ctx, c.initPayload) + if !isValidPayload { + c.sendConnectionError("invalid init payload") + c.close(websocket.CloseNormalClosure, "terminated") + return false + } + } + c.write(&operationMessage{Type: connectionAckMsg}) case connectionTerminateMsg: c.close(websocket.CloseNormalClosure, "terminated") diff --git a/handler/websocket_test.go b/handler/websocket_test.go index f8675475c94..2a458f45f45 100644 --- a/handler/websocket_test.go +++ b/handler/websocket_test.go @@ -1,6 +1,7 @@ package handler import ( + "context" "encoding/json" "net/http/httptest" "strings" @@ -158,6 +159,55 @@ func TestWebsocketWithKeepAlive(t *testing.T) { }) } +func TestWebsocketOnInitFunc(t *testing.T) { + next := make(chan struct{}) + + t.Run("accept connection if WebsocketOnInitFunc is NOT provided", func(t *testing.T) { + h := GraphQL(&executableSchemaStub{next}) + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + require.Equal(t, connectionAckMsg, readOp(c).Type) + }) + + t.Run("accept connection if WebsocketOnInitFunc is provided and is accepting connection", func(t *testing.T) { + h := GraphQL(&executableSchemaStub{next}, WebsocketOnInitFunc(func(ctx context.Context, initPayload InitPayload) bool { + return true + })) + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + require.Equal(t, connectionAckMsg, readOp(c).Type) + }) + + t.Run("reject connection if WebsocketOnInitFunc is provided and is accepting connection", func(t *testing.T) { + h := GraphQL(&executableSchemaStub{next}, WebsocketOnInitFunc(func(ctx context.Context, initPayload InitPayload) bool { + return false + })) + srv := httptest.NewServer(h) + defer srv.Close() + + c := wsConnect(srv.URL) + defer c.Close() + + require.NoError(t, c.WriteJSON(&operationMessage{Type: connectionInitMsg})) + + msg := readOp(c) + require.Equal(t, connectionErrorMsg, msg.Type) + require.Equal(t, `{"message":"invalid init payload"}`, string(msg.Payload)) + }) +} + func wsConnect(url string) *websocket.Conn { c, _, err := websocket.DefaultDialer.Dial(strings.Replace(url, "http://", "ws://", -1), nil) if err != nil { From a6508b6d4fbec8fcba56091293fc4e5ade3a13aa Mon Sep 17 00:00:00 2001 From: Eddy Date: Tue, 18 Jun 2019 13:54:15 +1000 Subject: [PATCH 16/30] Update typing, function name and small code refactor --- handler/graphql.go | 10 ++++++---- handler/websocket.go | 5 ++--- handler/websocket_test.go | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/handler/graphql.go b/handler/graphql.go index 5b963641d71..c266d4c946c 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -30,6 +30,8 @@ type params struct { Variables map[string]interface{} `json:"variables"` } +type websocketInitFunc func(ctx context.Context, initPayload InitPayload) bool + type Config struct { cacheSize int upgrader websocket.Upgrader @@ -40,7 +42,7 @@ type Config struct { tracer graphql.Tracer complexityLimit int complexityLimitFunc graphql.ComplexityLimitFunc - websocketOnInitFunc func(ctx context.Context, initPayload InitPayload) bool + websocketInitFunc websocketInitFunc disableIntrospection bool connectionKeepAlivePingInterval time.Duration uploadMaxMemory int64 @@ -251,11 +253,11 @@ func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) { tw.tracer1.EndOperationExecution(ctx) } -// WebsocketOnInitFunc is called when the server receives connection init message from the client. +// WebsocketInitFunc is called when the server receives connection init message from the client. // This can be used to check initial payload to see whether to accept the websocket connection. -func WebsocketOnInitFunc(websocketOnInitFunc func(ctx context.Context, initPayload InitPayload) bool) Option { +func WebsocketInitFunc(websocketInitFunc func(ctx context.Context, initPayload InitPayload) bool) Option { return func(cfg *Config) { - cfg.websocketOnInitFunc = websocketOnInitFunc + cfg.websocketInitFunc = websocketInitFunc } } diff --git a/handler/websocket.go b/handler/websocket.go index 0747e63bc72..a9a74893d20 100644 --- a/handler/websocket.go +++ b/handler/websocket.go @@ -94,9 +94,8 @@ func (c *wsConnection) init() bool { } } - if c.cfg.websocketOnInitFunc != nil { - isValidPayload := c.cfg.websocketOnInitFunc(c.ctx, c.initPayload) - if !isValidPayload { + if c.cfg.websocketInitFunc != nil { + if ok := c.cfg.websocketInitFunc(c.ctx, c.initPayload); !ok { c.sendConnectionError("invalid init payload") c.close(websocket.CloseNormalClosure, "terminated") return false diff --git a/handler/websocket_test.go b/handler/websocket_test.go index 2a458f45f45..b7d5e89905a 100644 --- a/handler/websocket_test.go +++ b/handler/websocket_test.go @@ -159,10 +159,10 @@ func TestWebsocketWithKeepAlive(t *testing.T) { }) } -func TestWebsocketOnInitFunc(t *testing.T) { +func TestWebsocketInitFunc(t *testing.T) { next := make(chan struct{}) - t.Run("accept connection if WebsocketOnInitFunc is NOT provided", func(t *testing.T) { + t.Run("accept connection if WebsocketInitFunc is NOT provided", func(t *testing.T) { h := GraphQL(&executableSchemaStub{next}) srv := httptest.NewServer(h) defer srv.Close() @@ -175,8 +175,8 @@ func TestWebsocketOnInitFunc(t *testing.T) { require.Equal(t, connectionAckMsg, readOp(c).Type) }) - t.Run("accept connection if WebsocketOnInitFunc is provided and is accepting connection", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}, WebsocketOnInitFunc(func(ctx context.Context, initPayload InitPayload) bool { + t.Run("accept connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { + h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) bool { return true })) srv := httptest.NewServer(h) @@ -190,8 +190,8 @@ func TestWebsocketOnInitFunc(t *testing.T) { require.Equal(t, connectionAckMsg, readOp(c).Type) }) - t.Run("reject connection if WebsocketOnInitFunc is provided and is accepting connection", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}, WebsocketOnInitFunc(func(ctx context.Context, initPayload InitPayload) bool { + t.Run("reject connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { + h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) bool { return false })) srv := httptest.NewServer(h) From be18ae1feaedfdba4787a745b8b62d981955912c Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 18 Jun 2019 14:59:40 +1000 Subject: [PATCH 17/30] Add a test --- codegen/testserver/generated.go | 204 ++++++++++++++++++++++++ codegen/testserver/gqlgen.yml | 4 + codegen/testserver/otherpkg/model.go | 7 + codegen/testserver/resolver.go | 6 + codegen/testserver/stub.go | 8 + codegen/testserver/wrapped_type.go | 6 + codegen/testserver/wrapped_type.graphql | 9 ++ codegen/testserver/wrapped_type_test.go | 54 +++++++ 8 files changed, 298 insertions(+) create mode 100644 codegen/testserver/otherpkg/model.go create mode 100644 codegen/testserver/wrapped_type.go create mode 100644 codegen/testserver/wrapped_type.graphql create mode 100644 codegen/testserver/wrapped_type_test.go diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index d7a074445a8..3d5f4b6c6fe 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -221,6 +221,8 @@ type ComplexityRoot struct { User func(childComplexity int, id int) int Valid func(childComplexity int) int ValidType func(childComplexity int) int + WrappedScalar func(childComplexity int) int + WrappedStruct func(childComplexity int) int } Rectangle struct { @@ -255,6 +257,10 @@ type ComplexityRoot struct { ValidInputKeywords func(childComplexity int, input *ValidInput) int } + WrappedStruct struct { + Name func(childComplexity int) int + } + XXIt struct { ID func(childComplexity int) int } @@ -335,6 +341,8 @@ type QueryResolver interface { Fallback(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) OptionalUnion(ctx context.Context) (TestUnion, error) ValidType(ctx context.Context) (*ValidType, error) + WrappedStruct(ctx context.Context) (*WrappedStruct, error) + WrappedScalar(ctx context.Context) (WrappedScalar, error) } type SubscriptionResolver interface { Updated(ctx context.Context) (<-chan string, error) @@ -1013,6 +1021,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.ValidType(childComplexity), true + case "Query.wrappedScalar": + if e.complexity.Query.WrappedScalar == nil { + break + } + + return e.complexity.Query.WrappedScalar(childComplexity), true + + case "Query.wrappedStruct": + if e.complexity.Query.WrappedStruct == nil { + break + } + + return e.complexity.Query.WrappedStruct(childComplexity), true + case "Rectangle.area": if e.complexity.Rectangle.Area == nil { break @@ -1142,6 +1164,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ValidType.ValidInputKeywords(childComplexity, args["input"].(*ValidInput)), true + case "WrappedStruct.name": + if e.complexity.WrappedStruct.Name == nil { + break + } + + return e.complexity.WrappedStruct.Name(childComplexity), true + case "XXIt.id": if e.complexity.XXIt.ID == nil { break @@ -1659,6 +1688,16 @@ type AIt { id: ID! } type XXIt { id: ID! } type AbIt { id: ID! } type XxIt { id: ID! } +`}, + &ast.Source{Name: "wrapped_type.graphql", Input: `# regression test for https://github.com/99designs/gqlgen/issues/721 + +extend type Query { + wrappedStruct: WrappedStruct! + wrappedScalar: WrappedScalar! +} + +type WrappedStruct { name: String! } +scalar WrappedScalar `}, ) @@ -4561,6 +4600,60 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. return ec.marshalOValidType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidType(ctx, field.Selections, res) } +func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().WrappedStruct(rctx) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*WrappedStruct) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().WrappedScalar(rctx) + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(WrappedScalar) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx, field.Selections, res) +} + func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() @@ -5073,6 +5166,33 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap return ec.marshalNBoolean2bool(ctx, field.Selections, res) } +func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) graphql.Marshaler { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { ec.Tracer.EndFieldExecution(ctx) }() + rctx := &graphql.ResolverContext{ + Object: "WrappedStruct", + Field: field, + Args: nil, + IsMethod: false, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, nil + }) + if resTmp == nil { + if !ec.HasError(rctx) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalNString2string(ctx, field.Selections, res) +} + func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) graphql.Marshaler { ctx = ec.Tracer.StartFieldExecution(ctx, field) defer func() { ec.Tracer.EndFieldExecution(ctx) }() @@ -7730,6 +7850,34 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr res = ec._Query_validType(ctx, field) return res }) + case "wrappedStruct": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_wrappedStruct(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) + case "wrappedScalar": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_wrappedScalar(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&invalids, 1) + } + return res + }) case "__type": out.Values[i] = ec._Query___type(ctx, field) case "__schema": @@ -7921,6 +8069,33 @@ func (ec *executionContext) _ValidType(ctx context.Context, sel ast.SelectionSet return out } +var wrappedStructImplementors = []string{"WrappedStruct"} + +func (ec *executionContext) _WrappedStruct(ctx context.Context, sel ast.SelectionSet, obj *WrappedStruct) graphql.Marshaler { + fields := graphql.CollectFields(ec.RequestContext, sel, wrappedStructImplementors) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("WrappedStruct") + case "name": + out.Values[i] = ec._WrappedStruct_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch() + if invalids > 0 { + return graphql.Null + } + return out +} + var xXItImplementors = []string{"XXIt"} func (ec *executionContext) _XXIt(ctx context.Context, sel ast.SelectionSet, obj *XXIt) graphql.Marshaler { @@ -8768,6 +8943,35 @@ func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ return ec._User(ctx, sel, v) } +func (ec *executionContext) unmarshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx context.Context, v interface{}) (WrappedScalar, error) { + tmp, err := graphql.UnmarshalString(v) + return WrappedScalar(tmp), err +} + +func (ec *executionContext) marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx context.Context, sel ast.SelectionSet, v WrappedScalar) graphql.Marshaler { + res := graphql.MarshalString(string(v)) + if res == graphql.Null { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + +func (ec *executionContext) marshalNWrappedStruct2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx context.Context, sel ast.SelectionSet, v WrappedStruct) graphql.Marshaler { + return ec._WrappedStruct(ctx, sel, &v) +} + +func (ec *executionContext) marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx context.Context, sel ast.SelectionSet, v *WrappedStruct) graphql.Marshaler { + if v == nil { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + return ec._WrappedStruct(ctx, sel, v) +} + func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } diff --git a/codegen/testserver/gqlgen.yml b/codegen/testserver/gqlgen.yml index 411e8277976..4a8292fb5bd 100644 --- a/codegen/testserver/gqlgen.yml +++ b/codegen/testserver/gqlgen.yml @@ -76,3 +76,7 @@ models: model: "github.com/99designs/gqlgen/codegen/testserver.FallbackToStringEncoding" Bytes: model: "github.com/99designs/gqlgen/codegen/testserver.Bytes" + WrappedStruct: + model: "github.com/99designs/gqlgen/codegen/testserver.WrappedStruct" + WrappedScalar: + model: "github.com/99designs/gqlgen/codegen/testserver.WrappedScalar" diff --git a/codegen/testserver/otherpkg/model.go b/codegen/testserver/otherpkg/model.go new file mode 100644 index 00000000000..b3f856b6e57 --- /dev/null +++ b/codegen/testserver/otherpkg/model.go @@ -0,0 +1,7 @@ +package otherpkg + +type Scalar string + +type Struct struct { + Name string +} diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index 012b2103850..e82ec74efae 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -203,6 +203,12 @@ func (r *queryResolver) OptionalUnion(ctx context.Context) (TestUnion, error) { func (r *queryResolver) ValidType(ctx context.Context) (*ValidType, error) { panic("not implemented") } +func (r *queryResolver) WrappedStruct(ctx context.Context) (*WrappedStruct, error) { + panic("not implemented") +} +func (r *queryResolver) WrappedScalar(ctx context.Context) (WrappedScalar, error) { + panic("not implemented") +} type subscriptionResolver struct{ *Resolver } diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index ee69e0c7b37..2537853f499 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -71,6 +71,8 @@ type Stub struct { Fallback func(ctx context.Context, arg FallbackToStringEncoding) (FallbackToStringEncoding, error) OptionalUnion func(ctx context.Context) (TestUnion, error) ValidType func(ctx context.Context) (*ValidType, error) + WrappedStruct func(ctx context.Context) (*WrappedStruct, error) + WrappedScalar func(ctx context.Context) (WrappedScalar, error) } SubscriptionResolver struct { Updated func(ctx context.Context) (<-chan string, error) @@ -273,6 +275,12 @@ func (r *stubQuery) OptionalUnion(ctx context.Context) (TestUnion, error) { func (r *stubQuery) ValidType(ctx context.Context) (*ValidType, error) { return r.QueryResolver.ValidType(ctx) } +func (r *stubQuery) WrappedStruct(ctx context.Context) (*WrappedStruct, error) { + return r.QueryResolver.WrappedStruct(ctx) +} +func (r *stubQuery) WrappedScalar(ctx context.Context) (WrappedScalar, error) { + return r.QueryResolver.WrappedScalar(ctx) +} type stubSubscription struct{ *Stub } diff --git a/codegen/testserver/wrapped_type.go b/codegen/testserver/wrapped_type.go new file mode 100644 index 00000000000..d9d318f403b --- /dev/null +++ b/codegen/testserver/wrapped_type.go @@ -0,0 +1,6 @@ +package testserver + +import "github.com/99designs/gqlgen/codegen/testserver/otherpkg" + +type WrappedScalar otherpkg.Scalar +type WrappedStruct otherpkg.Struct diff --git a/codegen/testserver/wrapped_type.graphql b/codegen/testserver/wrapped_type.graphql new file mode 100644 index 00000000000..f50e334e4e2 --- /dev/null +++ b/codegen/testserver/wrapped_type.graphql @@ -0,0 +1,9 @@ +# regression test for https://github.com/99designs/gqlgen/issues/721 + +extend type Query { + wrappedStruct: WrappedStruct! + wrappedScalar: WrappedScalar! +} + +type WrappedStruct { name: String! } +scalar WrappedScalar diff --git a/codegen/testserver/wrapped_type_test.go b/codegen/testserver/wrapped_type_test.go new file mode 100644 index 00000000000..0842fa3ba03 --- /dev/null +++ b/codegen/testserver/wrapped_type_test.go @@ -0,0 +1,54 @@ +package testserver + +import ( + "context" + "net/http/httptest" + "testing" + + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/codegen/testserver/otherpkg" + "github.com/99designs/gqlgen/handler" + "github.com/stretchr/testify/require" +) + +func TestWrappedTypes(t *testing.T) { + resolvers := &Stub{} + + srv := httptest.NewServer(handler.GraphQL(NewExecutableSchema(Config{Resolvers: resolvers}))) + c := client.New(srv.URL) + + resolvers.QueryResolver.WrappedScalar = func(ctx context.Context) (scalar WrappedScalar, e error) { + return WrappedScalar("hello"), nil + } + + resolvers.QueryResolver.WrappedStruct = func(ctx context.Context) (wrappedStruct *WrappedStruct, e error) { + wrapped := WrappedStruct(otherpkg.Struct{ + Name: "hello", + }) + return &wrapped, nil + } + + t.Run("wrapped struct", func(t *testing.T) { + var resp struct { + WrappedStruct struct { + Name string + } + } + + err := c.Post(`query { wrappedStruct { name } }`, &resp) + require.NoError(t, err) + + require.Equal(t, "hello", resp.WrappedStruct.Name) + }) + + t.Run("wrapped scalar", func(t *testing.T) { + var resp struct { + WrappedScalar string + } + + err := c.Post(`query { wrappedScalar }`, &resp) + require.NoError(t, err) + + require.Equal(t, "hello", resp.WrappedScalar) + }) +} From c397be0c409c7566214fa673a504a4f5821d4bf5 Mon Sep 17 00:00:00 2001 From: Eddy Date: Tue, 18 Jun 2019 15:07:06 +1000 Subject: [PATCH 18/30] Update websocketInitFunc to return error instead of boolean --- handler/graphql.go | 4 ++-- handler/websocket.go | 4 ++-- handler/websocket_test.go | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/handler/graphql.go b/handler/graphql.go index c266d4c946c..8c3882ce9c2 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -30,7 +30,7 @@ type params struct { Variables map[string]interface{} `json:"variables"` } -type websocketInitFunc func(ctx context.Context, initPayload InitPayload) bool +type websocketInitFunc func(ctx context.Context, initPayload InitPayload) error type Config struct { cacheSize int @@ -255,7 +255,7 @@ func (tw *tracerWrapper) EndOperationExecution(ctx context.Context) { // WebsocketInitFunc is called when the server receives connection init message from the client. // This can be used to check initial payload to see whether to accept the websocket connection. -func WebsocketInitFunc(websocketInitFunc func(ctx context.Context, initPayload InitPayload) bool) Option { +func WebsocketInitFunc(websocketInitFunc func(ctx context.Context, initPayload InitPayload) error) Option { return func(cfg *Config) { cfg.websocketInitFunc = websocketInitFunc } diff --git a/handler/websocket.go b/handler/websocket.go index a9a74893d20..07a1a8c2dd8 100644 --- a/handler/websocket.go +++ b/handler/websocket.go @@ -95,8 +95,8 @@ func (c *wsConnection) init() bool { } if c.cfg.websocketInitFunc != nil { - if ok := c.cfg.websocketInitFunc(c.ctx, c.initPayload); !ok { - c.sendConnectionError("invalid init payload") + if err := c.cfg.websocketInitFunc(c.ctx, c.initPayload); err != nil { + c.sendConnectionError(err.Error()) c.close(websocket.CloseNormalClosure, "terminated") return false } diff --git a/handler/websocket_test.go b/handler/websocket_test.go index b7d5e89905a..dc3e656e5fe 100644 --- a/handler/websocket_test.go +++ b/handler/websocket_test.go @@ -3,6 +3,7 @@ package handler import ( "context" "encoding/json" + "errors" "net/http/httptest" "strings" "testing" @@ -176,8 +177,8 @@ func TestWebsocketInitFunc(t *testing.T) { }) t.Run("accept connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) bool { - return true + h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) error { + return nil })) srv := httptest.NewServer(h) defer srv.Close() @@ -191,8 +192,8 @@ func TestWebsocketInitFunc(t *testing.T) { }) t.Run("reject connection if WebsocketInitFunc is provided and is accepting connection", func(t *testing.T) { - h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) bool { - return false + h := GraphQL(&executableSchemaStub{next}, WebsocketInitFunc(func(ctx context.Context, initPayload InitPayload) error { + return errors.New("invalid init payload") })) srv := httptest.NewServer(h) defer srv.Close() From 69d7e28241b9847a073f1a335a5cc12e2efddf05 Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 18 Jun 2019 09:41:16 +0300 Subject: [PATCH 19/30] move directive to directives.gotpl --- codegen/data.go | 34 +++-- codegen/directive.go | 18 ++- codegen/directives.gotpl | 84 +++++++++++++ codegen/generated!.gotpl | 138 ++------------------- codegen/testserver/generated.go | 4 + example/chat/generated.go | 80 ++++++------ example/config/generated.go | 4 + example/dataloader/generated.go | 4 + example/fileupload/generated.go | 4 + example/scalars/generated.go | 4 + example/selection/generated.go | 4 + example/starwars/generated/exec.go | 4 + example/todo/generated.go | 136 ++++++++++---------- example/type-system-extension/generated.go | 4 + integration/generated.go | 4 + 15 files changed, 270 insertions(+), 256 deletions(-) create mode 100644 codegen/directives.gotpl diff --git a/codegen/data.go b/codegen/data.go index ca32707067a..12c85921064 100644 --- a/codegen/data.go +++ b/codegen/data.go @@ -12,18 +12,15 @@ import ( // Data is a unified model of the code to be generated. Plugins may modify this structure to do things like implement // resolvers or directives automatically (eg grpc, validation) type Data struct { - Config *config.Config - Schema *ast.Schema - SchemaStr map[string]string - Directives DirectiveList - QueryDirectives DirectiveList - MutationDirectives DirectiveList - SubscriptionDirectives DirectiveList - Objects Objects - Inputs Objects - Interfaces map[string]*Interface - ReferencedTypes map[string]*config.TypeReference - ComplexityRoots map[string]*Object + Config *config.Config + Schema *ast.Schema + SchemaStr map[string]string + Directives DirectiveList + Objects Objects + Inputs Objects + Interfaces map[string]*Interface + ReferencedTypes map[string]*config.TypeReference + ComplexityRoots map[string]*Object QueryRoot *Object MutationRoot *Object @@ -74,14 +71,11 @@ func BuildData(cfg *config.Config) (*Data, error) { } s := Data{ - Config: cfg, - Directives: dataDirectives, - QueryDirectives: locationDirectives(dataDirectives, ast.LocationQuery), - MutationDirectives: locationDirectives(dataDirectives, ast.LocationMutation), - SubscriptionDirectives: locationDirectives(dataDirectives, ast.LocationSubscription), - Schema: b.Schema, - SchemaStr: b.SchemaStr, - Interfaces: map[string]*Interface{}, + Config: cfg, + Directives: dataDirectives, + Schema: b.Schema, + SchemaStr: b.SchemaStr, + Interfaces: map[string]*Interface{}, } for _, schemaType := range b.Schema.Types { diff --git a/codegen/directive.go b/codegen/directive.go index dccf914d36b..5857717c520 100644 --- a/codegen/directive.go +++ b/codegen/directive.go @@ -12,6 +12,11 @@ import ( type DirectiveList map[string]*Directive +//LocationDirectives filter directives by location +func (dl DirectiveList) LocationDirectives(location string) DirectiveList { + return locationDirectives(dl, ast.DirectiveLocation(location)) +} + type Directive struct { *ast.DirectiveDefinition Name string @@ -19,20 +24,23 @@ type Directive struct { Builtin bool } -func (d *Directive) IsLocation(location ast.DirectiveLocation) bool { +//IsLocation check location directive +func (d *Directive) IsLocation(location ...ast.DirectiveLocation) bool { for _, l := range d.Locations { - if l == location { - return true + for _, a := range location { + if l == a { + return true + } } } return false } -func locationDirectives(directives DirectiveList, location ast.DirectiveLocation) map[string]*Directive { +func locationDirectives(directives DirectiveList, location ...ast.DirectiveLocation) map[string]*Directive { mDirectives := make(map[string]*Directive) for name, d := range directives { - if d.IsLocation(location) { + if d.IsLocation(location...) { mDirectives[name] = d } } diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl new file mode 100644 index 00000000000..1db2177a8ec --- /dev/null +++ b/codegen/directives.gotpl @@ -0,0 +1,84 @@ + +{{define "queryDirectives"}} + for _, d := range obj.Directives { + switch d.Name { + {{- range $directive := . }} + case "{{$directive.Name}}": + {{- if $directive.Args }} + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + {{- end }} + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) + } + {{- end }} + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null +{{end}} + +{{ if .Directives.LocationDirectives "QUERY" }} +func (ec *executionContext) _queryMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { + {{ template "queryDirectives" .Directives.LocationDirectives "QUERY" }} +} +{{ end }} + +{{ if .Directives.LocationDirectives "MUTATION" }} +func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { + {{ template "queryDirectives" .Directives.LocationDirectives "MUTATION" }} +} +{{ end }} + +{{ if .Directives.LocationDirectives "SUBSCRIPTION" }} +func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func() graphql.Marshaler { + for _, d := range obj.Directives { + switch d.Name { + {{- range $directive := .Directives.LocationDirectives "SUBSCRIPTION" }} + case "{{$directive.Name}}": + {{- if $directive.Args }} + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + if err != nil { + ec.Error(ctx, err) + return func() graphql.Marshaler { + return graphql.Null + } + } + {{- end }} + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) + } + {{- end }} + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return func() graphql.Marshaler { + return graphql.Null + } + } + if data, ok := tmp.(func() graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return func() graphql.Marshaler { + return graphql.Null + } +} +{{ end }} diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index ce040ef18b0..dec7cbc8231 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -117,8 +117,10 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - {{ if .QueryDirectives -}} - data := ec._{{.QueryRoot.Name}}Middleware(ctx, op) + {{ if .Directives.LocationDirectives "QUERY" -}} + data := ec._queryMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){ + return ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet), nil + }) {{- else -}} data := ec._{{.QueryRoot.Name}}(ctx, op.SelectionSet) {{- end }} @@ -142,8 +144,10 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - {{ if .MutationDirectives -}} - data := ec._{{.MutationRoot.Name}}Middleware(ctx, op) + {{ if .Directives.LocationDirectives "MUTATION" -}} + data := ec._mutationMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){ + return ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet), nil + }) {{- else -}} data := ec._{{.MutationRoot.Name}}(ctx, op.SelectionSet) {{- end }} @@ -166,8 +170,10 @@ func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDe {{- if .SubscriptionRoot }} ec := executionContext{graphql.GetRequestContext(ctx), e} - {{ if .SubscriptionDirectives -}} - next := ec._{{.SubscriptionRoot.Name}}Middleware(ctx, op) + {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} + next := ec._subscriptionMiddleware(ctx, op, func(ctx context.Context) (interface{}, error){ + return ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet),nil + }) {{- else -}} next := ec._{{.SubscriptionRoot.Name}}(ctx, op.SelectionSet) {{- end }} @@ -208,126 +214,6 @@ type executionContext struct { *executableSchema } -{{ if and .QueryDirectives .QueryRoot }} -func (ec *executionContext) _{{.QueryRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { - - next := func(ctx context.Context) (interface{}, error){ - return ec._{{.QueryRoot.Name}}(ctx, obj.SelectionSet),nil - } - for _, d := range obj.Directives { - switch d.Name { - {{- range $directive := .QueryDirectives }} - case "{{$directive.Name}}": - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - {{- end }} - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if data, ok := tmp.(graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return graphql.Null -} -{{end}} - -{{ if and .SubscriptionDirectives .SubscriptionRoot }} -func (ec *executionContext) _{{.SubscriptionRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) func() graphql.Marshaler { - - next := func(ctx context.Context) (interface{}, error){ - return ec._{{.SubscriptionRoot.Name}}(ctx, obj.SelectionSet),nil - } - for _, d := range obj.Directives { - switch d.Name { - {{- range $directive := .SubscriptionDirectives }} - case "{{$directive.Name}}": - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return func() graphql.Marshaler { - return graphql.Null - } - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - {{- end }} - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return func() graphql.Marshaler { - return graphql.Null - } - } - if data, ok := tmp.(func() graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return func() graphql.Marshaler { - return graphql.Null - } -} -{{end}} - -{{ if and .MutationDirectives .MutationRoot }} -func (ec *executionContext) _{{.MutationRoot.Name}}Middleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { - - next := func(ctx context.Context) (interface{}, error){ - return ec._{{.MutationRoot.Name}}(ctx, obj.SelectionSet),nil - } - for _, d := range obj.Directives { - switch d.Name { - {{- range $directive := .MutationDirectives }} - case "{{$directive.Name}}": - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - {{- end }} - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if data, ok := tmp.(graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return graphql.Null -} -{{end}} - func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index d7a074445a8..39dc204e0dd 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -2263,6 +2263,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) graphql.Marshaler { diff --git a/example/chat/generated.go b/example/chat/generated.go index 15ffd28ce48..9ac1ae7528e 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -214,7 +214,9 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini func (e *executableSchema) Subscription(ctx context.Context, op *ast.OperationDefinition) func() *graphql.Response { ec := executionContext{graphql.GetRequestContext(ctx), e} - next := ec._SubscriptionMiddleware(ctx, op) + next := ec._subscriptionMiddleware(ctx, op, func(ctx context.Context) (interface{}, error) { + return ec._Subscription(ctx, op.SelectionSet), nil + }) if ec.Errors != nil { return graphql.OneShot(&graphql.Response{Data: []byte("null"), Errors: ec.Errors}) } @@ -249,44 +251,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) _SubscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition) func() graphql.Marshaler { - - next := func(ctx context.Context) (interface{}, error) { - return ec._Subscription(ctx, obj.SelectionSet), nil - } - for _, d := range obj.Directives { - switch d.Name { - case "user": - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_user_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return func() graphql.Marshaler { - return graphql.Null - } - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.User(ctx, obj, n, args["username"].(string)) - } - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return func() graphql.Marshaler { - return graphql.Null - } - } - if data, ok := tmp.(func() graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return func() graphql.Marshaler { - return graphql.Null - } -} - func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { @@ -485,6 +449,44 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) func() graphql.Marshaler { + for _, d := range obj.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return func() graphql.Marshaler { + return graphql.Null + } + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["username"].(string)) + } + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return func() graphql.Marshaler { + return graphql.Null + } + } + if data, ok := tmp.(func() graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return func() graphql.Marshaler { + return graphql.Null + } +} + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) graphql.Marshaler { diff --git a/example/config/generated.go b/example/config/generated.go index ccf93600be2..da6797bc36c 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -326,6 +326,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 2bf7166d442..6ac5e7da1d4 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -393,6 +393,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) graphql.Marshaler { diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 54b77979cd2..a9c76071976 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -375,6 +375,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) graphql.Marshaler { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index 62a3e059b13..a5bd8819019 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -364,6 +364,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) graphql.Marshaler { diff --git a/example/selection/generated.go b/example/selection/generated.go index 26c3ef43848..9aa5781b15f 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -282,6 +282,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index b70c74cfb85..ff3f2add346 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -945,6 +945,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { diff --git a/example/todo/generated.go b/example/todo/generated.go index 29681516cbd..a5ec211b6b3 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -167,7 +167,9 @@ func (e *executableSchema) Query(ctx context.Context, op *ast.OperationDefinitio ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._MyQueryMiddleware(ctx, op) + data := ec._queryMiddleware(ctx, op, func(ctx context.Context) (interface{}, error) { + return ec._MyQuery(ctx, op.SelectionSet), nil + }) var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -184,7 +186,9 @@ func (e *executableSchema) Mutation(ctx context.Context, op *ast.OperationDefini ec := executionContext{graphql.GetRequestContext(ctx), e} buf := ec.RequestMiddleware(ctx, func(ctx context.Context) []byte { - data := ec._MyMutationMiddleware(ctx, op) + data := ec._mutationMiddleware(ctx, op, func(ctx context.Context) (interface{}, error) { + return ec._MyMutation(ctx, op.SelectionSet), nil + }) var buf bytes.Buffer data.MarshalGQL(&buf) return buf.Bytes() @@ -206,70 +210,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) _MyQueryMiddleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { - - next := func(ctx context.Context) (interface{}, error) { - return ec._MyQuery(ctx, obj.SelectionSet), nil - } - for _, d := range obj.Directives { - switch d.Name { - case "user": - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_user_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.User(ctx, obj, n, args["id"].(int)) - } - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if data, ok := tmp.(graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return graphql.Null -} - -func (ec *executionContext) _MyMutationMiddleware(ctx context.Context, obj *ast.OperationDefinition) graphql.Marshaler { - - next := func(ctx context.Context) (interface{}, error) { - return ec._MyMutation(ctx, obj.SelectionSet), nil - } - for _, d := range obj.Directives { - switch d.Name { - case "user": - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_user_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.User(ctx, obj, n, args["id"].(int)) - } - } - } - tmp, err := next(ctx) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if data, ok := tmp.(graphql.Marshaler); ok { - return data - } - ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) - return graphql.Null -} - func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { defer func() { if r := recover(); r != nil { @@ -500,6 +440,70 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +func (ec *executionContext) _queryMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { + + for _, d := range obj.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["id"].(int)) + } + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null + +} + +func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.OperationDefinition, next func(ctx context.Context) (interface{}, error)) graphql.Marshaler { + + for _, d := range obj.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["id"].(int)) + } + } + } + tmp, err := next(ctx) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if data, ok := tmp.(graphql.Marshaler); ok { + return data + } + ec.Errorf(ctx, `unexpected type %T from directive, should be graphql.Marshaler`, tmp) + return graphql.Null + +} + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index dd98089c711..42853d3dabb 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -439,6 +439,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { diff --git a/integration/generated.go b/integration/generated.go index 36c283c220d..69815c31825 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -442,6 +442,10 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // endregion ***************************** args.gotpl ***************************** +// region ************************** directives.gotpl ************************** + +// endregion ************************** directives.gotpl ************************** + // region **************************** field.gotpl ***************************** func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) graphql.Marshaler { From dbd2cc6e5d5eedfad3c857c4d8cb1052a25ff19f Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 24 Jun 2019 11:37:36 +1000 Subject: [PATCH 20/30] simplify resolver test --- cmd/gen.go | 16 ++ plugin/resolvergen/out/model.go | 14 ++ plugin/resolvergen/out/resolver.go | 26 ++++ plugin/resolvergen/resolver_test.go | 173 ++++----------------- plugin/resolvergen/testdata/gqlgen.yml | 14 ++ plugin/resolvergen/testdata/schema.graphql | 7 + 6 files changed, 106 insertions(+), 144 deletions(-) create mode 100644 plugin/resolvergen/out/model.go create mode 100644 plugin/resolvergen/out/resolver.go create mode 100644 plugin/resolvergen/testdata/gqlgen.yml create mode 100644 plugin/resolvergen/testdata/schema.graphql diff --git a/cmd/gen.go b/cmd/gen.go index c69858b44b0..2d3f2aa1aac 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -6,6 +6,7 @@ import ( "github.com/99designs/gqlgen/api" "github.com/99designs/gqlgen/codegen/config" + "github.com/99designs/gqlgen/plugin/modelgen" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -42,3 +43,18 @@ var genCmd = cli.Command{ } }, } + +func main() { + cfg, err := config.LoadConfigFromDefaultLocations() + if os.IsNotExist(errors.Cause(err)) { + cfg = config.DefaultConfig() + } else if err != nil { + fmt.Fprintln(os.Stderr, err.Error()) + os.Exit(2) + } + + err = modelgen.New().(*modelgen.Plugin).MutateConfig(cfg) + if err != nil { + panic(err) + } +} diff --git a/plugin/resolvergen/out/model.go b/plugin/resolvergen/out/model.go new file mode 100644 index 00000000000..11d6d254209 --- /dev/null +++ b/plugin/resolvergen/out/model.go @@ -0,0 +1,14 @@ +package customresolver + +import "context" + +type Resolver struct { +} + +type QueryResolver interface { + Resolver(ctx context.Context) (*Resolver, error) +} + +type ResolverResolver interface { + Name(ctx context.Context, obj *Resolver) (string, error) +} diff --git a/plugin/resolvergen/out/resolver.go b/plugin/resolvergen/out/resolver.go new file mode 100644 index 00000000000..8461fbbbb29 --- /dev/null +++ b/plugin/resolvergen/out/resolver.go @@ -0,0 +1,26 @@ +package customresolver + +import ( + "context" +) // THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES. + +type CustomResolverType struct{} + +func (r *CustomResolverType) Query() QueryResolver { + return &queryCustomResolverType{r} +} +func (r *CustomResolverType) Resolver() ResolverResolver { + return &resolverCustomResolverType{r} +} + +type queryCustomResolverType struct{ *CustomResolverType } + +func (r *queryCustomResolverType) Resolver(ctx context.Context) (*Resolver, error) { + panic("not implemented") +} + +type resolverCustomResolverType struct{ *CustomResolverType } + +func (r *resolverCustomResolverType) Name(ctx context.Context, obj *Resolver) (string, error) { + panic("not implemented") +} diff --git a/plugin/resolvergen/resolver_test.go b/plugin/resolvergen/resolver_test.go index b100f7cc74c..fce700db7fa 100644 --- a/plugin/resolvergen/resolver_test.go +++ b/plugin/resolvergen/resolver_test.go @@ -2,162 +2,47 @@ package resolvergen import ( "fmt" - "go/types" - "io/ioutil" - "os" - "path/filepath" - "strings" + "syscall" "testing" - "unicode" "github.com/99designs/gqlgen/codegen" "github.com/99designs/gqlgen/codegen/config" - "github.com/vektah/gqlparser/ast" + "github.com/stretchr/testify/require" + "golang.org/x/tools/go/packages" ) -func TestPlugin_Name(t *testing.T) { - t.Run("test plugin name", func(t *testing.T) { - m := &Plugin{} - if got, want := m.Name(), "resovlergen"; got != want { - t.Errorf("Plugin.Name() = %v, want %v", got, want) - } - }) -} +func TestPlugin(t *testing.T) { + _ = syscall.Unlink("out/resolver.go") -// Types for testing code generation, both Mutation and -// MutationResolver must implement types.Type. -type Mutation struct{} + cfg, err := config.LoadConfig("testdata/gqlgen.yml") + require.NoError(t, err) + p := Plugin{} -func (m *Mutation) Underlying() types.Type { - return m -} - -func (m *Mutation) String() string { - return "Mutation" -} - -type MutationResolver struct{} - -func (m *MutationResolver) Underlying() types.Type { - return m -} + data, err := codegen.BuildData(cfg) + if err != nil { + panic(err) + } -func (m *MutationResolver) String() string { - return "MutationResolver" + require.NoError(t, p.GenerateCode(data)) + assertNoErrors(t, "github.com/99designs/gqlgen/plugin/resolvergen/out") } -func TestPlugin_GenerateCode(t *testing.T) { - makeData := func(cfg config.PackageConfig) *codegen.Data { - m := &Mutation{} - obj := &codegen.Object{ - Definition: &ast.Definition{ - Name: fmt.Sprint(m), - }, - Root: true, - Fields: []*codegen.Field{ - &codegen.Field{ - IsResolver: true, - GoFieldName: "Name", - TypeReference: &config.TypeReference{ - GO: m, - }, - }, - }, - ResolverInterface: &MutationResolver{}, - } - obj.Fields[0].Object = obj - return &codegen.Data{ - Config: &config.Config{ - Resolver: cfg, - }, - Objects: codegen.Objects{obj}, - } +func assertNoErrors(t *testing.T, pkg string) { + pkgs, err := packages.Load(&packages.Config{ + Mode: packages.LoadTypes, + }, pkg) + if err != nil { + panic(err) } - t.Run("renders expected contents", func(t *testing.T) { - m := &Plugin{} - - // use a temp dir to ensure generated file uniqueness, - // since if a file already exists it won't be - // overwritten. - tempDir, err := ioutil.TempDir("", "resolvergen-") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tempDir) - filename := filepath.Join(tempDir, "generated.go") - - data := makeData(config.PackageConfig{ - Filename: filename, - Package: "customresolver", - Type: "CustomResolverType", - }) - if err := m.GenerateCode(data); err != nil { - t.Fatal(err) - } - - byteContents, err := ioutil.ReadFile(filename) - if err != nil { - t.Fatal(err) + hasErrors := false + for _, pkg := range pkgs { + for _, err := range pkg.Errors { + hasErrors = true + fmt.Println(err.Pos + ":" + err.Msg) } - contents := string(byteContents) - - want := "package customresolver" - if !strings.Contains(contents, want) { - t.Fatalf("expected package name not found: want = %q\n%s", want, contents) - } - - // Skip all white-space chars after start and want - // length. Useful to jump to next non-white character - // contents for generated code assertions. - skipWhitespace := func(start int, want string) int { - return start + len(want) + strings.IndexFunc( - string(contents[start+len(want):]), - func(r rune) bool { return !unicode.IsSpace(r) }, - ) - } - // Check if want begins at the given start point. - lookingAt := func(start int, want string) bool { - return strings.Index(string(contents[start:]), want) == 0 - } - - // Assert Mutation method contents for *CustomResolverType - want = "func (r *CustomResolverType) Mutation() MutationResolver {" - start := strings.Index(contents, want) - if start == -1 { - t.Fatalf("mutation method for custom resolver not found: want = %q\n%s", want, contents) - } - start = skipWhitespace(start, want) - want = "return &mutationCustomResolverType{r}" - if !lookingAt(start, want) { - t.Fatalf("unexpected return on mutation method for custom resolver: want = %q\n%s", want, contents) - } - start = skipWhitespace(start, want) - want = "}" - if !lookingAt(start, want) { - t.Fatalf("unexpected contents on mutation method for custom resolver: want = %q\n%s", want, contents) - } - - want = "type mutationCustomResolverType struct{ *CustomResolverType }" - if !strings.Contains(contents, want) { - t.Fatalf("expected embedded resolver type struct not found: want = %q\n%s", want, contents) - } - - // Assert Name method contents for *mutationCustomResolverType - want = "func (r *mutationCustomResolverType) Name(ctx context.Context) (Mutation, error) {" - start = strings.Index(contents, want) - if start == -1 { - t.Fatalf("Name method for mutation custom resolver type not found: want = %q\n%s", want, contents) - } - start = skipWhitespace(start, want) - want = `panic("not implemented")` - if !lookingAt(start, want) { - t.Fatalf("unexpected Name method contents for mutation custom resolver type: want = %q\n%s", want, contents) - } - start = skipWhitespace(start, want) - want = "}" - if !lookingAt(start, want) { - t.Fatalf("unexpected Name method contents for mutation custom resolver type: want = %q\n%s", want, contents) - } - }) + } + if hasErrors { + t.Fatal("see compilation errors above") + } } diff --git a/plugin/resolvergen/testdata/gqlgen.yml b/plugin/resolvergen/testdata/gqlgen.yml new file mode 100644 index 00000000000..f5f0f7bdcb7 --- /dev/null +++ b/plugin/resolvergen/testdata/gqlgen.yml @@ -0,0 +1,14 @@ +schema: + - "testdata/schema.graphql" + +exec: + filename: out/ignored.go +model: + filename: out/generated.go +resolver: + filename: out/resolver.go + type: CustomResolverType + +models: + Resolver: + model: github.com/99designs/gqlgen/plugin/resolvergen/out.Resolver diff --git a/plugin/resolvergen/testdata/schema.graphql b/plugin/resolvergen/testdata/schema.graphql new file mode 100644 index 00000000000..7ced7397b57 --- /dev/null +++ b/plugin/resolvergen/testdata/schema.graphql @@ -0,0 +1,7 @@ +type Query { + resolver: Resolver! +} + +type Resolver { + name: String! +} From f28ed264310d3c62c0a19a5de742d006019a7675 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 24 Jun 2019 14:33:50 +1000 Subject: [PATCH 21/30] Add coveralls --- .circleci/config.yml | 4 ++++ .circleci/coverage.sh | 6 ++++++ .circleci/golang.Dockerfile | 1 + cmd/gen.go | 16 ---------------- 4 files changed, 11 insertions(+), 16 deletions(-) create mode 100755 .circleci/coverage.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 26e594fb29d..199ef43e084 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,10 @@ jobs: docker build -f .circleci/golang.Dockerfile -t gqlgen/golang . docker build -f .circleci/node.Dockerfile -t gqlgen/node . + - run: + name: "coverage" + command: docker run -e REPOTOKEN --rm gqlgen/golang .circleci/coverage.sh + - run: name: "golang tests" command: docker run --rm gqlgen/golang .circleci/test.sh diff --git a/.circleci/coverage.sh b/.circleci/coverage.sh new file mode 100755 index 00000000000..e04e48401b9 --- /dev/null +++ b/.circleci/coverage.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -eu + +go test -coverprofile=/tmp/coverage.out -coverpkg=./... $(go list github.com/99designs/gqlgen/... | grep -v server) +goveralls -coverprofile=/tmp/coverage.out -service=circle-ci -repotoken=$REPOTOKEN -ignore='example/*/*,example/*/*/*,integration/*,integration/*/*,codegen/testserver/*' diff --git a/.circleci/golang.Dockerfile b/.circleci/golang.Dockerfile index a0ceb286bf9..54673182cb8 100644 --- a/.circleci/golang.Dockerfile +++ b/.circleci/golang.Dockerfile @@ -1,6 +1,7 @@ FROM golang:1.11 RUN curl -sL --fail https://github.com/golangci/golangci-lint/releases/download/v1.13/golangci-lint-1.13-linux-amd64.tar.gz | tar zxv --strip-components=1 --dir=/go/bin +RUN go get github.com/mattn/goveralls WORKDIR /projects/gqlgen diff --git a/cmd/gen.go b/cmd/gen.go index 2d3f2aa1aac..c69858b44b0 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -6,7 +6,6 @@ import ( "github.com/99designs/gqlgen/api" "github.com/99designs/gqlgen/codegen/config" - "github.com/99designs/gqlgen/plugin/modelgen" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -43,18 +42,3 @@ var genCmd = cli.Command{ } }, } - -func main() { - cfg, err := config.LoadConfigFromDefaultLocations() - if os.IsNotExist(errors.Cause(err)) { - cfg = config.DefaultConfig() - } else if err != nil { - fmt.Fprintln(os.Stderr, err.Error()) - os.Exit(2) - } - - err = modelgen.New().(*modelgen.Plugin).MutateConfig(cfg) - if err != nil { - panic(err) - } -} From a4480fb078794d8761a77d5053abf7fd0cb759fc Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 24 Jun 2019 16:37:13 +1000 Subject: [PATCH 22/30] fix globbing on windows --- codegen/config/config.go | 20 ++++++++++++------- codegen/config/config_test.go | 16 ++++++++++++--- plugin/resolvergen/resolver_test.go | 4 ++-- plugin/resolvergen/testdata/gqlgen.yml | 8 ++++---- .../resolvergen/{ => testdata}/out/model.go | 0 .../{ => testdata}/out/resolver.go | 0 6 files changed, 32 insertions(+), 16 deletions(-) rename plugin/resolvergen/{ => testdata}/out/model.go (100%) rename plugin/resolvergen/{ => testdata}/out/resolver.go (100%) diff --git a/codegen/config/config.go b/codegen/config/config.go index 1139a66ec0b..1425b69e3ed 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -52,6 +52,13 @@ func LoadConfigFromDefaultLocations() (*Config, error) { return LoadConfig(cfgFile) } +var path2regex = strings.NewReplacer( + `.`, `\.`, + `*`, `.+`, + `\`, `[\\/]`, + `/`, `[\\/]`, +) + // LoadConfig reads the gqlgen.yml config file func LoadConfig(filename string) (*Config, error) { config := DefaultConfig() @@ -74,18 +81,17 @@ func LoadConfig(filename string) (*Config, error) { // subdirectories to match schema files. if strings.Contains(f, "**") { pathParts := strings.SplitN(f, "**", 2) + rest := strings.TrimPrefix(strings.TrimPrefix(pathParts[1], `\`), `/`) + // turn the rest of the glob into a regex, anchored only at the end because ** allows + // for any number of dirs in between and walk will let us match against the full path name + globRe := regexp.MustCompile(path2regex.Replace(rest) + `$`) + if err := filepath.Walk(pathParts[0], func(path string, info os.FileInfo, err error) error { if err != nil { return err } - // make sure paths match files - // ?.*\. - fileRegex := regexp.MustCompile( - pathParts[0] + - "?.*" + - strings.Replace(strings.Replace(pathParts[1], ".", "\\.", -1), "*", ".+", -1)) - if fileRegex.MatchString(path) { + if globRe.MatchString(strings.TrimPrefix(path, pathParts[0])) { matches = append(matches, path) } diff --git a/codegen/config/config_test.go b/codegen/config/config_test.go index e84f940f9f5..5408ecbcc0d 100644 --- a/codegen/config/config_test.go +++ b/codegen/config/config_test.go @@ -3,6 +3,7 @@ package config import ( "os" "path/filepath" + "runtime" "testing" "github.com/stretchr/testify/assert" @@ -29,13 +30,22 @@ func TestLoadConfig(t *testing.T) { c, err := LoadConfig("testdata/cfg/glob.yml") require.NoError(t, err) - require.Equal(t, c.SchemaFilename[0], "testdata/cfg/glob/bar/bar with spaces.graphql") - require.Equal(t, c.SchemaFilename[1], "testdata/cfg/glob/foo/foo.graphql") + if runtime.GOOS == "windows" { + require.Equal(t, c.SchemaFilename[0], `testdata\cfg\glob\bar\bar with spaces.graphql`) + require.Equal(t, c.SchemaFilename[1], `testdata\cfg\glob\foo\foo.graphql`) + } else { + require.Equal(t, c.SchemaFilename[0], "testdata/cfg/glob/bar/bar with spaces.graphql") + require.Equal(t, c.SchemaFilename[1], "testdata/cfg/glob/foo/foo.graphql") + } }) t.Run("unwalkable path", func(t *testing.T) { _, err := LoadConfig("testdata/cfg/unwalkable.yml") - require.EqualError(t, err, "failed to walk schema at root not_walkable/: lstat not_walkable/: no such file or directory") + if runtime.GOOS == "windows" { + require.EqualError(t, err, "failed to walk schema at root not_walkable/: FindFirstFile not_walkable/: The parameter is incorrect.") + } else { + require.EqualError(t, err, "failed to walk schema at root not_walkable/: lstat not_walkable/: no such file or directory") + } }) } diff --git a/plugin/resolvergen/resolver_test.go b/plugin/resolvergen/resolver_test.go index fce700db7fa..1fab8cded27 100644 --- a/plugin/resolvergen/resolver_test.go +++ b/plugin/resolvergen/resolver_test.go @@ -12,7 +12,7 @@ import ( ) func TestPlugin(t *testing.T) { - _ = syscall.Unlink("out/resolver.go") + _ = syscall.Unlink("testdata/out/resolver.go") cfg, err := config.LoadConfig("testdata/gqlgen.yml") require.NoError(t, err) @@ -24,7 +24,7 @@ func TestPlugin(t *testing.T) { } require.NoError(t, p.GenerateCode(data)) - assertNoErrors(t, "github.com/99designs/gqlgen/plugin/resolvergen/out") + assertNoErrors(t, "github.com/99designs/gqlgen/plugin/resolvergen/testdata/out") } func assertNoErrors(t *testing.T, pkg string) { diff --git a/plugin/resolvergen/testdata/gqlgen.yml b/plugin/resolvergen/testdata/gqlgen.yml index f5f0f7bdcb7..29e8970013a 100644 --- a/plugin/resolvergen/testdata/gqlgen.yml +++ b/plugin/resolvergen/testdata/gqlgen.yml @@ -2,13 +2,13 @@ schema: - "testdata/schema.graphql" exec: - filename: out/ignored.go + filename: testdata/out/ignored.go model: - filename: out/generated.go + filename: testdata/out/generated.go resolver: - filename: out/resolver.go + filename: testdata/out/resolver.go type: CustomResolverType models: Resolver: - model: github.com/99designs/gqlgen/plugin/resolvergen/out.Resolver + model: github.com/99designs/gqlgen/plugin/resolvergen/testdata/out.Resolver diff --git a/plugin/resolvergen/out/model.go b/plugin/resolvergen/testdata/out/model.go similarity index 100% rename from plugin/resolvergen/out/model.go rename to plugin/resolvergen/testdata/out/model.go diff --git a/plugin/resolvergen/out/resolver.go b/plugin/resolvergen/testdata/out/resolver.go similarity index 100% rename from plugin/resolvergen/out/resolver.go rename to plugin/resolvergen/testdata/out/resolver.go From dd162f04051c034bfae7c8fb3732975dec449586 Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 25 Jun 2019 07:09:47 +0300 Subject: [PATCH 23/30] define implDirectives template --- codegen/args.gotpl | 22 +- codegen/directives.gotpl | 13 ++ codegen/input.gotpl | 22 +- codegen/testserver/generated.go | 242 ++++++++++----------- example/chat/generated.go | 32 +-- example/config/generated.go | 20 +- example/dataloader/generated.go | 20 +- example/fileupload/generated.go | 32 +-- example/scalars/generated.go | 24 +- example/selection/generated.go | 12 +- example/starwars/generated/exec.go | 72 +++--- example/todo/generated.go | 38 ++-- example/type-system-extension/generated.go | 24 +- integration/generated.go | 32 +-- 14 files changed, 297 insertions(+), 308 deletions(-) diff --git a/codegen/args.gotpl b/codegen/args.gotpl index 4c7212182c8..e7d30ef146e 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -1,26 +1,14 @@ {{ range $name, $args := .Args }} -func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) {{ $name }}(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} {{- range $i, $arg := . }} var arg{{$i}} {{ $arg.TypeReference.GO | ref}} - if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { + if tmp, ok := in[{{$arg.Name|quote}}]; ok { {{- if $arg.Directives }} - getArg0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } - - {{- range $i, $directive := $arg.Directives }} - getArg{{add $i 1}} := func(ctx context.Context) (res interface{}, err error) { - {{- range $dArg := $directive.Args }} - {{- if and $dArg.TypeReference.IsPtr ( notNil "Value" $dArg ) }} - {{ $dArg.VarName }} := {{ $dArg.Value | dump }} - {{- end }} - {{- end }} - n := getArg{{$i}} - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "tmp" "n" }}) - } - {{- end }} - - tmp, err = getArg{{$arg.Directives|len}}(ctx) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } + {{ template "implDirectives" $arg }} + tmp, err = directive{{$arg.Directives|len}}(ctx) if err != nil { return nil, err } diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index 1db2177a8ec..9d8863a7546 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -1,3 +1,16 @@ +{{ define "implDirectives" }} + {{- range $i, $directive := .Directives -}} + directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { + {{- range $arg := $directive.Args }} + {{- if and $arg.TypeReference.IsPtr ( notNil "Value" $arg ) }} + {{ $arg.VarName }} := {{ $arg.Value | dump }} + {{- end }} + {{- end }} + n := directive{{$i}} + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "in" "n" }}) + } + {{- end }} +{{ end }} {{define "queryDirectives"}} for _, d := range obj.Directives { diff --git a/codegen/input.gotpl b/codegen/input.gotpl index c8ac7ad3a5d..348037cc05e 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -1,8 +1,8 @@ {{- range $input := .Inputs }} {{- if not .HasUnmarshal }} - func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, v interface{}) ({{.Type | ref}}, error) { + func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, in interface{}) ({{.Type | ref}}, error) { var it {{.Type | ref}} - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) {{ range $field := .Fields}} {{- if $field.Default}} if _, present := asMap[{{$field.Name|quote}}] ; !present { @@ -17,21 +17,9 @@ case {{$field.Name|quote}}: var err error {{- if $field.Directives }} - getField0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } - - {{- range $i, $directive := $field.Directives }} - getField{{add $i 1}} := func(ctx context.Context) (res interface{}, err error) { - {{- range $dArg := $directive.Args }} - {{- if and $dArg.TypeReference.IsPtr ( notNil "Value" $dArg ) }} - {{ $dArg.VarName }} := {{ $dArg.Value | dump }} - {{- end }} - {{- end }} - n := getField{{$i}} - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "it" "n" }}) - } - {{- end }} - - tmp, err := getField{{$field.Directives|len}}(ctx) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } + {{ template "implDirectives" $field }} + tmp, err := directive{{$field.Directives|len}}(ctx) if err != nil { return it, err } diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 05f4db80553..0404a17ec5e 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1705,11 +1705,11 @@ scalar WrappedScalar // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_length_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := rawArgs["min"]; ok { + if tmp, ok := in["min"]; ok { arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err @@ -1717,7 +1717,7 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str } args["min"] = arg0 var arg1 *int - if tmp, ok := rawArgs["max"]; ok { + if tmp, ok := in["max"]; ok { arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -1727,11 +1727,11 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str return args, nil } -func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_range_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := rawArgs["min"]; ok { + if tmp, ok := in["min"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -1739,7 +1739,7 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri } args["min"] = arg0 var arg1 *int - if tmp, ok := rawArgs["max"]; ok { + if tmp, ok := in["max"]; ok { arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -1749,11 +1749,11 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri return args, nil } -func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []MarshalPanic - if tmp, ok := rawArgs["u"]; ok { + if tmp, ok := in["u"]; ok { arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, tmp) if err != nil { return nil, err @@ -1763,11 +1763,11 @@ func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []MarshalPanic - if tmp, ok := rawArgs["u"]; ok { + if tmp, ok := in["u"]; ok { arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, tmp) if err != nil { return nil, err @@ -1777,11 +1777,11 @@ func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -1791,11 +1791,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["arg"]; ok { + if tmp, ok := in["arg"]; ok { arg0, err = ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) if err != nil { return nil, err @@ -1805,19 +1805,19 @@ func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["arg"]; ok { - getArg0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, tmp) } - getArg1 := func(ctx context.Context) (res interface{}, err error) { + if tmp, ok := in["arg"]; ok { + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, tmp) } + directive1 := func(ctx context.Context) (interface{}, error) { max := 255 - n := getArg0 - return ec.directives.Length(ctx, tmp, n, 1, &max) + n := directive0 + return ec.directives.Length(ctx, in, n, 1, &max) } - tmp, err = getArg1(ctx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -1831,11 +1831,11 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, r return args, nil } -func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *InputDirectives - if tmp, ok := rawArgs["arg"]; ok { + if tmp, ok := in["arg"]; ok { arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) if err != nil { return nil, err @@ -1845,20 +1845,20 @@ func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context. return args, nil } -func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 InnerInput - if tmp, ok := rawArgs["arg"]; ok { - getArg0 := func(ctx context.Context) (interface{}, error) { + if tmp, ok := in["arg"]; ok { + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, tmp) } - getArg1 := func(ctx context.Context) (res interface{}, err error) { - n := getArg0 - return ec.directives.Custom(ctx, tmp, n) + directive1 := func(ctx context.Context) (interface{}, error) { + n := directive0 + return ec.directives.Custom(ctx, in, n) } - tmp, err = getArg1(ctx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -1872,11 +1872,11 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont return args, nil } -func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 InputDirectives - if tmp, ok := rawArgs["arg"]; ok { + if tmp, ok := in["arg"]; ok { arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) if err != nil { return nil, err @@ -1886,19 +1886,19 @@ func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := rawArgs["arg"]; ok { - getArg0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } - getArg1 := func(ctx context.Context) (res interface{}, err error) { + if tmp, ok := in["arg"]; ok { + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } + directive1 := func(ctx context.Context) (interface{}, error) { min := 0 - n := getArg0 - return ec.directives.Range(ctx, tmp, n, &min, nil) + n := directive0 + return ec.directives.Range(ctx, in, n, &min, nil) } - tmp, err = getArg1(ctx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -1910,15 +1910,15 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co } args["arg"] = arg0 var arg1 *int - if tmp, ok := rawArgs["arg2"]; ok { - getArg0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } - getArg1 := func(ctx context.Context) (res interface{}, err error) { + if tmp, ok := in["arg2"]; ok { + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } + directive1 := func(ctx context.Context) (interface{}, error) { min := 0 - n := getArg0 - return ec.directives.Range(ctx, tmp, n, &min, nil) + n := directive0 + return ec.directives.Range(ctx, in, n, &min, nil) } - tmp, err = getArg1(ctx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -1932,11 +1932,11 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return args, nil } -func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_fallback_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 FallbackToStringEncoding - if tmp, ok := rawArgs["arg"]; ok { + if tmp, ok := in["arg"]; ok { arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, tmp) if err != nil { return nil, err @@ -1946,11 +1946,11 @@ func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawAr return args, nil } -func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []string - if tmp, ok := rawArgs["arg"]; ok { + if tmp, ok := in["arg"]; ok { arg0, err = ec.unmarshalNString2ᚕstring(ctx, tmp) if err != nil { return nil, err @@ -1960,11 +1960,11 @@ func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, raw return args, nil } -func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 map[string]interface{} - if tmp, ok := rawArgs["input"]; ok { + if tmp, ok := in["input"]; ok { arg0, err = ec.unmarshalOChanges2map(ctx, tmp) if err != nil { return nil, err @@ -1974,11 +1974,11 @@ func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawAr return args, nil } -func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 map[string]interface{} - if tmp, ok := rawArgs["in"]; ok { + if tmp, ok := in["in"]; ok { arg0, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) if err != nil { return nil, err @@ -1988,11 +1988,11 @@ func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Cont return args, nil } -func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 [][]*OuterInput - if tmp, ok := rawArgs["input"]; ok { + if tmp, ok := in["input"]; ok { arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, tmp) if err != nil { return nil, err @@ -2002,11 +2002,11 @@ func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, r return args, nil } -func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := rawArgs["arg"]; ok { + if tmp, ok := in["arg"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -2016,11 +2016,11 @@ func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_recursive_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *RecursiveInputSlice - if tmp, ok := rawArgs["input"]; ok { + if tmp, ok := in["input"]; ok { arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, tmp) if err != nil { return nil, err @@ -2030,11 +2030,11 @@ func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawA return args, nil } -func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err @@ -2044,11 +2044,11 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m return args, nil } -func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["break"]; ok { + if tmp, ok := in["break"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2056,7 +2056,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["break"] = arg0 var arg1 string - if tmp, ok := rawArgs["default"]; ok { + if tmp, ok := in["default"]; ok { arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2064,7 +2064,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["default"] = arg1 var arg2 string - if tmp, ok := rawArgs["func"]; ok { + if tmp, ok := in["func"]; ok { arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2072,7 +2072,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["func"] = arg2 var arg3 string - if tmp, ok := rawArgs["interface"]; ok { + if tmp, ok := in["interface"]; ok { arg3, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2080,7 +2080,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["interface"] = arg3 var arg4 string - if tmp, ok := rawArgs["select"]; ok { + if tmp, ok := in["select"]; ok { arg4, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2088,7 +2088,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["select"] = arg4 var arg5 string - if tmp, ok := rawArgs["case"]; ok { + if tmp, ok := in["case"]; ok { arg5, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2096,7 +2096,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["case"] = arg5 var arg6 string - if tmp, ok := rawArgs["defer"]; ok { + if tmp, ok := in["defer"]; ok { arg6, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2104,7 +2104,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["defer"] = arg6 var arg7 string - if tmp, ok := rawArgs["go"]; ok { + if tmp, ok := in["go"]; ok { arg7, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2112,7 +2112,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["go"] = arg7 var arg8 string - if tmp, ok := rawArgs["map"]; ok { + if tmp, ok := in["map"]; ok { arg8, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2120,7 +2120,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["map"] = arg8 var arg9 string - if tmp, ok := rawArgs["struct"]; ok { + if tmp, ok := in["struct"]; ok { arg9, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2128,7 +2128,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["struct"] = arg9 var arg10 string - if tmp, ok := rawArgs["chan"]; ok { + if tmp, ok := in["chan"]; ok { arg10, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2136,7 +2136,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["chan"] = arg10 var arg11 string - if tmp, ok := rawArgs["else"]; ok { + if tmp, ok := in["else"]; ok { arg11, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2144,7 +2144,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["else"] = arg11 var arg12 string - if tmp, ok := rawArgs["goto"]; ok { + if tmp, ok := in["goto"]; ok { arg12, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2152,7 +2152,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["goto"] = arg12 var arg13 string - if tmp, ok := rawArgs["package"]; ok { + if tmp, ok := in["package"]; ok { arg13, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2160,7 +2160,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["package"] = arg13 var arg14 string - if tmp, ok := rawArgs["switch"]; ok { + if tmp, ok := in["switch"]; ok { arg14, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2168,7 +2168,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["switch"] = arg14 var arg15 string - if tmp, ok := rawArgs["const"]; ok { + if tmp, ok := in["const"]; ok { arg15, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2176,7 +2176,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["const"] = arg15 var arg16 string - if tmp, ok := rawArgs["fallthrough"]; ok { + if tmp, ok := in["fallthrough"]; ok { arg16, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2184,7 +2184,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["fallthrough"] = arg16 var arg17 string - if tmp, ok := rawArgs["if"]; ok { + if tmp, ok := in["if"]; ok { arg17, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2192,7 +2192,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["if"] = arg17 var arg18 string - if tmp, ok := rawArgs["range"]; ok { + if tmp, ok := in["range"]; ok { arg18, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2200,7 +2200,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["range"] = arg18 var arg19 string - if tmp, ok := rawArgs["type"]; ok { + if tmp, ok := in["type"]; ok { arg19, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2208,7 +2208,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["type"] = arg19 var arg20 string - if tmp, ok := rawArgs["continue"]; ok { + if tmp, ok := in["continue"]; ok { arg20, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2216,7 +2216,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["continue"] = arg20 var arg21 string - if tmp, ok := rawArgs["for"]; ok { + if tmp, ok := in["for"]; ok { arg21, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2224,7 +2224,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["for"] = arg21 var arg22 string - if tmp, ok := rawArgs["import"]; ok { + if tmp, ok := in["import"]; ok { arg22, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2232,7 +2232,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["import"] = arg22 var arg23 string - if tmp, ok := rawArgs["return"]; ok { + if tmp, ok := in["return"]; ok { arg23, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2240,7 +2240,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["return"] = arg23 var arg24 string - if tmp, ok := rawArgs["var"]; ok { + if tmp, ok := in["var"]; ok { arg24, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2248,7 +2248,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["var"] = arg24 var arg25 string - if tmp, ok := rawArgs["_"]; ok { + if tmp, ok := in["_"]; ok { arg25, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2258,11 +2258,11 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *ValidInput - if tmp, ok := rawArgs["input"]; ok { + if tmp, ok := in["input"]; ok { arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx, tmp) if err != nil { return nil, err @@ -2272,11 +2272,11 @@ func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context. return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -2286,11 +2286,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -6136,21 +6136,21 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, v interface{}) (InnerDirectives, error) { +func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, in interface{}) (InnerDirectives, error) { var it InnerDirectives - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { case "message": var err error - getField0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } - getField1 := func(ctx context.Context) (res interface{}, err error) { - n := getField0 - return ec.directives.Length(ctx, it, n, 1, nil) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } + directive1 := func(ctx context.Context) (interface{}, error) { + n := directive0 + return ec.directives.Length(ctx, in, n, 1, nil) } - tmp, err := getField1(ctx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -6165,9 +6165,9 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, v return it, nil } -func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, v interface{}) (InnerInput, error) { +func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, in interface{}) (InnerInput, error) { var it InnerInput - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6183,22 +6183,22 @@ func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, v inte return it, nil } -func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, v interface{}) (InputDirectives, error) { +func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, in interface{}) (InputDirectives, error) { var it InputDirectives - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { case "text": var err error - getField0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } - getField1 := func(ctx context.Context) (res interface{}, err error) { + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } + directive1 := func(ctx context.Context) (interface{}, error) { max := 7 - n := getField0 - return ec.directives.Length(ctx, it, n, 0, &max) + n := directive0 + return ec.directives.Length(ctx, in, n, 0, &max) } - tmp, err := getField1(ctx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -6221,16 +6221,16 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, v } case "thirdParty": var err error - getField0 := func(ctx context.Context) (interface{}, error) { + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx, v) } - getField1 := func(ctx context.Context) (res interface{}, err error) { + directive1 := func(ctx context.Context) (interface{}, error) { max := 7 - n := getField0 - return ec.directives.Length(ctx, it, n, 0, &max) + n := directive0 + return ec.directives.Length(ctx, in, n, 0, &max) } - tmp, err := getField1(ctx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -6245,9 +6245,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, v return it, nil } -func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, v interface{}) (OuterInput, error) { +func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, in interface{}) (OuterInput, error) { var it OuterInput - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6263,9 +6263,9 @@ func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, v inte return it, nil } -func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Context, v interface{}) (RecursiveInputSlice, error) { +func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Context, in interface{}) (RecursiveInputSlice, error) { var it RecursiveInputSlice - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6281,9 +6281,9 @@ func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Contex return it, nil } -func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, v interface{}) (ValidInput, error) { +func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, in interface{}) (ValidInput, error) { var it ValidInput - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/chat/generated.go b/example/chat/generated.go index 9ac1ae7528e..30968d8c717 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -333,11 +333,11 @@ directive @user(username: String!) on SUBSCRIPTION // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["username"]; ok { + if tmp, ok := in["username"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -347,11 +347,11 @@ func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[strin return args, nil } -func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_post_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["text"]; ok { + if tmp, ok := in["text"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -359,7 +359,7 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg } args["text"] = arg0 var arg1 string - if tmp, ok := rawArgs["username"]; ok { + if tmp, ok := in["username"]; ok { arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -367,7 +367,7 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg } args["username"] = arg1 var arg2 string - if tmp, ok := rawArgs["roomName"]; ok { + if tmp, ok := in["roomName"]; ok { arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -377,11 +377,11 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -391,11 +391,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_room_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -405,11 +405,11 @@ func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs m return args, nil } -func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["roomName"]; ok { + if tmp, ok := in["roomName"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -419,11 +419,11 @@ func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Con return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -433,11 +433,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err diff --git a/example/config/generated.go b/example/config/generated.go index da6797bc36c..32975caa38a 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -268,11 +268,11 @@ input NewTodo { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 NewTodo - if tmp, ok := rawArgs["input"]; ok { + if tmp, ok := in["input"]; ok { arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(ctx, tmp) if err != nil { return nil, err @@ -282,11 +282,11 @@ func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -296,11 +296,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -310,11 +310,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -1468,9 +1468,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, v interface{}) (NewTodo, error) { +func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, in interface{}) (NewTodo, error) { var it NewTodo - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 6ac5e7da1d4..63eea24f162 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -321,11 +321,11 @@ scalar Time // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -335,11 +335,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []int - if tmp, ok := rawArgs["customerIds"]; ok { + if tmp, ok := in["customerIds"]; ok { arg0, err = ec.unmarshalOInt2ᚕint(ctx, tmp) if err != nil { return nil, err @@ -349,11 +349,11 @@ func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, rawA return args, nil } -func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 [][]int - if tmp, ok := rawArgs["customerIds"]; ok { + if tmp, ok := in["customerIds"]; ok { arg0, err = ec.unmarshalOInt2ᚕᚕint(ctx, tmp) if err != nil { return nil, err @@ -363,11 +363,11 @@ func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, rawA return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -377,11 +377,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index a9c76071976..9d0bb34fe9c 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -275,11 +275,11 @@ type Mutation { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []*model.UploadFile - if tmp, ok := rawArgs["req"]; ok { + if tmp, ok := in["req"]; ok { arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) if err != nil { return nil, err @@ -289,11 +289,11 @@ func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx co return args, nil } -func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []*graphql.Upload - if tmp, ok := rawArgs["files"]; ok { + if tmp, ok := in["files"]; ok { arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) if err != nil { return nil, err @@ -303,11 +303,11 @@ func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 model.UploadFile - if tmp, ok := rawArgs["req"]; ok { + if tmp, ok := in["req"]; ok { arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) if err != nil { return nil, err @@ -317,11 +317,11 @@ func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx cont return args, nil } -func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 graphql.Upload - if tmp, ok := rawArgs["file"]; ok { + if tmp, ok := in["file"]; ok { arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) if err != nil { return nil, err @@ -331,11 +331,11 @@ func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -345,11 +345,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -359,11 +359,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -1511,9 +1511,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, v interface{}) (model.UploadFile, error) { +func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, in interface{}) (model.UploadFile, error) { var it model.UploadFile - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index a5bd8819019..f487ea28207 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -292,11 +292,11 @@ scalar Banned // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -306,11 +306,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_search_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *model.SearchArgs - if tmp, ok := rawArgs["input"]; ok { + if tmp, ok := in["input"]; ok { arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx, tmp) if err != nil { return nil, err @@ -320,11 +320,11 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 external.ObjectID - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, tmp) if err != nil { return nil, err @@ -334,11 +334,11 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -348,11 +348,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -1579,9 +1579,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, v interface{}) (model.SearchArgs, error) { +func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, in interface{}) (model.SearchArgs, error) { var it model.SearchArgs - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/selection/generated.go b/example/selection/generated.go index 9aa5781b15f..8a8d7775703 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -238,11 +238,11 @@ scalar Time // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -252,11 +252,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -266,11 +266,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index ff3f2add346..c26611204fe 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -701,11 +701,11 @@ scalar Time // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := rawArgs["first"]; ok { + if tmp, ok := in["first"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -713,7 +713,7 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte } args["first"] = arg0 var arg1 *string - if tmp, ok := rawArgs["after"]; ok { + if tmp, ok := in["after"]; ok { arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err @@ -723,11 +723,11 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := rawArgs["first"]; ok { + if tmp, ok := in["first"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -735,7 +735,7 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte } args["first"] = arg0 var arg1 *string - if tmp, ok := rawArgs["after"]; ok { + if tmp, ok := in["after"]; ok { arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err @@ -745,11 +745,11 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Human_height_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Human_height_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.LengthUnit - if tmp, ok := rawArgs["unit"]; ok { + if tmp, ok := in["unit"]; ok { arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) if err != nil { return nil, err @@ -759,11 +759,11 @@ func (ec *executionContext) field_Human_height_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.Episode - if tmp, ok := rawArgs["episode"]; ok { + if tmp, ok := in["episode"]; ok { arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err @@ -771,7 +771,7 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context } args["episode"] = arg0 var arg1 models.Review - if tmp, ok := rawArgs["review"]; ok { + if tmp, ok := in["review"]; ok { arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, tmp) if err != nil { return nil, err @@ -781,11 +781,11 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -795,11 +795,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_character_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_character_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -809,11 +809,11 @@ func (ec *executionContext) field_Query_character_args(ctx context.Context, rawA return args, nil } -func (ec *executionContext) field_Query_droid_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_droid_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -823,11 +823,11 @@ func (ec *executionContext) field_Query_droid_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_hero_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_hero_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *models.Episode - if tmp, ok := rawArgs["episode"]; ok { + if tmp, ok := in["episode"]; ok { arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err @@ -837,11 +837,11 @@ func (ec *executionContext) field_Query_hero_args(ctx context.Context, rawArgs m return args, nil } -func (ec *executionContext) field_Query_human_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_human_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -851,11 +851,11 @@ func (ec *executionContext) field_Query_human_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_reviews_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.Episode - if tmp, ok := rawArgs["episode"]; ok { + if tmp, ok := in["episode"]; ok { arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err @@ -863,7 +863,7 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArg } args["episode"] = arg0 var arg1 *time.Time - if tmp, ok := rawArgs["since"]; ok { + if tmp, ok := in["since"]; ok { arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) if err != nil { return nil, err @@ -873,11 +873,11 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArg return args, nil } -func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_search_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["text"]; ok { + if tmp, ok := in["text"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -887,11 +887,11 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_starship_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_starship_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -901,11 +901,11 @@ func (ec *executionContext) field_Query_starship_args(ctx context.Context, rawAr return args, nil } -func (ec *executionContext) field_Starship_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Starship_length_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *models.LengthUnit - if tmp, ok := rawArgs["unit"]; ok { + if tmp, ok := in["unit"]; ok { arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) if err != nil { return nil, err @@ -915,11 +915,11 @@ func (ec *executionContext) field_Starship_length_args(ctx context.Context, rawA return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -929,11 +929,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -2899,9 +2899,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, v interface{}) (models.Review, error) { +func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, in interface{}) (models.Review, error) { var it models.Review - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/todo/generated.go b/example/todo/generated.go index a5ec211b6b3..9f4698f10bc 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -318,11 +318,11 @@ enum Role { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_hasRole_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 Role - if tmp, ok := rawArgs["role"]; ok { + if tmp, ok := in["role"]; ok { arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx, tmp) if err != nil { return nil, err @@ -332,11 +332,11 @@ func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[st return args, nil } -func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err @@ -346,11 +346,11 @@ func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[strin return args, nil } -func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 TodoInput - if tmp, ok := rawArgs["todo"]; ok { + if tmp, ok := in["todo"]; ok { arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(ctx, tmp) if err != nil { return nil, err @@ -360,11 +360,11 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context return args, nil } -func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err @@ -372,7 +372,7 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context } args["id"] = arg0 var arg1 map[string]interface{} - if tmp, ok := rawArgs["changes"]; ok { + if tmp, ok := in["changes"]; ok { arg1, err = ec.unmarshalNMap2map(ctx, tmp) if err != nil { return nil, err @@ -382,11 +382,11 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context return args, nil } -func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -396,11 +396,11 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawAr return args, nil } -func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err @@ -410,11 +410,11 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -424,11 +424,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -1620,9 +1620,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, v interface{}) (TodoInput, error) { +func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, in interface{}) (TodoInput, error) { var it TodoInput - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 42853d3dabb..5b9576ad27e 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -367,11 +367,11 @@ extend union Data @unionLogging // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 TodoInput - if tmp, ok := rawArgs["todo"]; ok { + if tmp, ok := in["todo"]; ok { arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx, tmp) if err != nil { return nil, err @@ -381,11 +381,11 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context return args, nil } -func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -395,11 +395,11 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawAr return args, nil } -func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["id"]; ok { + if tmp, ok := in["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -409,11 +409,11 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -423,11 +423,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -1531,9 +1531,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, v interface{}) (TodoInput, error) { +func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, in interface{}) (TodoInput, error) { var it TodoInput - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/integration/generated.go b/integration/generated.go index 69815c31825..64107e2ca34 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -342,11 +342,11 @@ enum ErrorType { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_magic_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_magic_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := rawArgs["kind"]; ok { + if tmp, ok := in["kind"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -356,11 +356,11 @@ func (ec *executionContext) dir_magic_args(ctx context.Context, rawArgs map[stri return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := rawArgs["name"]; ok { + if tmp, ok := in["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -370,11 +370,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field_Query_complexity_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_complexity_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := rawArgs["value"]; ok { + if tmp, ok := in["value"]; ok { arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err @@ -384,11 +384,11 @@ func (ec *executionContext) field_Query_complexity_args(ctx context.Context, raw return args, nil } -func (ec *executionContext) field_Query_date_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_date_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.DateFilter - if tmp, ok := rawArgs["filter"]; ok { + if tmp, ok := in["filter"]; ok { arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(ctx, tmp) if err != nil { return nil, err @@ -398,11 +398,11 @@ func (ec *executionContext) field_Query_date_args(ctx context.Context, rawArgs m return args, nil } -func (ec *executionContext) field_Query_error_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_error_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *models.ErrorType - if tmp, ok := rawArgs["type"]; ok { + if tmp, ok := in["type"]; ok { arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx, tmp) if err != nil { return nil, err @@ -412,11 +412,11 @@ func (ec *executionContext) field_Query_error_args(ctx context.Context, rawArgs return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -426,11 +426,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := rawArgs["includeDeprecated"]; ok { + if tmp, ok := in["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -1667,9 +1667,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, v interface{}) (models.DateFilter, error) { +func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, in interface{}) (models.DateFilter, error) { var it models.DateFilter - var asMap = v.(map[string]interface{}) + var asMap = in.(map[string]interface{}) if _, present := asMap["timezone"]; !present { asMap["timezone"] = "UTC" From be890ab9a1d887a1993aa3403c4e36c294003187 Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 25 Jun 2019 07:18:19 +0300 Subject: [PATCH 24/30] use UnmarshalFunc in args directives implement --- codegen/directive.go | 14 ++--- codegen/directives.gotpl | 17 ++++-- codegen/testserver/directive_test.go | 20 ++++--- codegen/testserver/generated.go | 90 +++++++++++++++++++++------- codegen/testserver/schema.graphql | 4 +- 5 files changed, 98 insertions(+), 47 deletions(-) diff --git a/codegen/directive.go b/codegen/directive.go index 5857717c520..0f61d060ca7 100644 --- a/codegen/directive.go +++ b/codegen/directive.go @@ -151,18 +151,12 @@ func (d *Directive) CallArgs() string { return strings.Join(args, ", ") } -func (d *Directive) ResolveArgs(obj string, next string) string { - args := []string{"ctx", obj, next} +func (d *Directive) ResolveArgs(obj string, next int) string { + args := []string{"ctx", obj, fmt.Sprintf("directive%d", next)} for _, arg := range d.Args { - dArg := "&" + arg.VarName - if !arg.TypeReference.IsPtr() { - if arg.Value != nil { - dArg = templates.Dump(arg.Value) - } else { - dArg = templates.Dump(arg.Default) - } - } else if arg.Value == nil && arg.Default == nil { + dArg := arg.VarName + if arg.Value == nil && arg.Default == nil { dArg = "nil" } diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index 9d8863a7546..72498d1e9c3 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -2,12 +2,19 @@ {{- range $i, $directive := .Directives -}} directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { {{- range $arg := $directive.Args }} - {{- if and $arg.TypeReference.IsPtr ( notNil "Value" $arg ) }} - {{ $arg.VarName }} := {{ $arg.Value | dump }} - {{- end }} + {{- if notNil "Value" $arg }} + {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Value | dump }}) + if err != nil{ + return nil, err + } + {{- else if notNil "Default" $arg }} + {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }}) + if err != nil{ + return nil, err + } + {{- end }} {{- end }} - n := directive{{$i}} - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "in" "n" }}) + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "in" $i }}) } {{- end }} {{ end }} diff --git a/codegen/testserver/directive_test.go b/codegen/testserver/directive_test.go index 494be75f959..3d6badd0804 100644 --- a/codegen/testserver/directive_test.go +++ b/codegen/testserver/directive_test.go @@ -44,7 +44,13 @@ func TestDirectives(t *testing.T) { NewExecutableSchema(Config{ Resolvers: resolvers, Directives: DirectiveRoot{ - Length: func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int) (interface{}, error) { + Length: func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int, message *string) (interface{}, error) { + e := func(msg string) error { + if message == nil{ + return fmt.Errorf(msg) + } + return fmt.Errorf(*message) + } res, err := next(ctx) if err != nil { return nil, err @@ -52,10 +58,10 @@ func TestDirectives(t *testing.T) { s := res.(string) if len(s) < min { - return nil, fmt.Errorf("too short") + return nil, e("too short") } if max != nil && len(s) > *max { - return nil, fmt.Errorf("too long") + return nil, e("too long") } return res, nil }, @@ -119,7 +125,7 @@ func TestDirectives(t *testing.T) { err := c.Post(`query { directiveArg(arg: "") }`, &resp) - require.EqualError(t, err, `[{"message":"too short","path":["directiveArg"]}]`) + require.EqualError(t, err, `[{"message":"invalid length","path":["directiveArg"]}]`) require.Nil(t, resp.DirectiveArg) }) t.Run("when function errors on nullable arg directives", func(t *testing.T) { @@ -171,7 +177,7 @@ func TestDirectives(t *testing.T) { err := c.Post(`query { directiveInputNullable(arg: {text:"invalid text",inner:{message:"123"}}) }`, &resp) - require.EqualError(t, err, `[{"message":"too long","path":["directiveInputNullable"]}]`) + require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable"]}]`) require.Nil(t, resp.DirectiveInputNullable) }) t.Run("when function errors on inner directives", func(t *testing.T) { @@ -181,7 +187,7 @@ func TestDirectives(t *testing.T) { err := c.Post(`query { directiveInputNullable(arg: {text:"2",inner:{message:""}}) }`, &resp) - require.EqualError(t, err, `[{"message":"too short","path":["directiveInputNullable"]}]`) + require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable"]}]`) require.Nil(t, resp.DirectiveInputNullable) }) t.Run("when function errors on nullable inner directives", func(t *testing.T) { @@ -191,7 +197,7 @@ func TestDirectives(t *testing.T) { err := c.Post(`query { directiveInputNullable(arg: {text:"success",inner:{message:"1"},innerNullable:{message:""}}) }`, &resp) - require.EqualError(t, err, `[{"message":"too short","path":["directiveInputNullable"]}]`) + require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable"]}]`) require.Nil(t, resp.DirectiveInputNullable) }) t.Run("when function success", func(t *testing.T) { diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 0404a17ec5e..91f1fe4c2b4 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -54,7 +54,7 @@ type ResolverRoot interface { type DirectiveRoot struct { Custom func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) - Length func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int) (res interface{}, err error) + Length func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int, message *string) (res interface{}, err error) Range func(ctx context.Context, obj interface{}, next graphql.Resolver, min *int, max *int) (res interface{}, err error) } @@ -1289,7 +1289,7 @@ func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{} } n := next next = func(ctx context.Context) (interface{}, error) { - return ec.directives.Length(ctx, obj, n, args["min"].(int), args["max"].(*int)) + return ec.directives.Length(ctx, obj, n, args["min"].(int), args["max"].(*int), args["message"].(*string)) } } case "range": @@ -1514,7 +1514,7 @@ input InputDirectives { text: String! @length(min: 0, max: 7, message: "not valid") inner: InnerDirectives! innerNullable: InnerDirectives - thirdParty: ThirdParty @length(min: 0, max: 7, message: "not valid") + thirdParty: ThirdParty @length(min: 0, max: 7) } input InnerDirectives { @@ -1552,7 +1552,7 @@ type EmbeddedPointer { Title: String } -directive @length(min: Int!, max: Int) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION +directive @length(min: Int!, max: Int, message: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION directive @range(min: Int = 0, max: Int) on ARGUMENT_DEFINITION directive @custom on ARGUMENT_DEFINITION @@ -1724,6 +1724,14 @@ func (ec *executionContext) dir_length_args(ctx context.Context, in map[string]i } } args["max"] = arg1 + var arg2 *string + if tmp, ok := in["message"]; ok { + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } + } + args["message"] = arg2 return args, nil } @@ -1812,9 +1820,19 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, i if tmp, ok := in["arg"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { - max := 255 - n := directive0 - return ec.directives.Length(ctx, in, n, 1, &max) + min, err := ec.unmarshalNInt2int(ctx, 1) + if err != nil { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 255) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") + if err != nil { + return nil, err + } + return ec.directives.Length(ctx, in, directive0, min, max, message) } tmp, err = directive1(ctx) @@ -1854,8 +1872,7 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { - n := directive0 - return ec.directives.Custom(ctx, in, n) + return ec.directives.Custom(ctx, in, directive0) } tmp, err = directive1(ctx) @@ -1893,9 +1910,11 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co if tmp, ok := in["arg"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { - min := 0 - n := directive0 - return ec.directives.Range(ctx, in, n, &min, nil) + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + if err != nil { + return nil, err + } + return ec.directives.Range(ctx, in, directive0, min, nil) } tmp, err = directive1(ctx) @@ -1913,9 +1932,11 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co if tmp, ok := in["arg2"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { - min := 0 - n := directive0 - return ec.directives.Range(ctx, in, n, &min, nil) + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + if err != nil { + return nil, err + } + return ec.directives.Range(ctx, in, directive0, min, nil) } tmp, err = directive1(ctx) @@ -6146,8 +6167,15 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, i var err error directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { - n := directive0 - return ec.directives.Length(ctx, in, n, 1, nil) + min, err := ec.unmarshalNInt2int(ctx, 1) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") + if err != nil { + return nil, err + } + return ec.directives.Length(ctx, in, directive0, min, nil, message) } tmp, err := directive1(ctx) @@ -6193,9 +6221,19 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, i var err error directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { - max := 7 - n := directive0 - return ec.directives.Length(ctx, in, n, 0, &max) + min, err := ec.unmarshalNInt2int(ctx, 0) + if err != nil { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 7) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") + if err != nil { + return nil, err + } + return ec.directives.Length(ctx, in, directive0, min, max, message) } tmp, err := directive1(ctx) @@ -6225,9 +6263,15 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, i return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { - max := 7 - n := directive0 - return ec.directives.Length(ctx, in, n, 0, &max) + min, err := ec.unmarshalNInt2int(ctx, 0) + if err != nil { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 7) + if err != nil { + return nil, err + } + return ec.directives.Length(ctx, in, directive0, min, max, nil) } tmp, err := directive1(ctx) diff --git a/codegen/testserver/schema.graphql b/codegen/testserver/schema.graphql index 0fd5b598651..a230aefa374 100644 --- a/codegen/testserver/schema.graphql +++ b/codegen/testserver/schema.graphql @@ -78,7 +78,7 @@ input InputDirectives { text: String! @length(min: 0, max: 7, message: "not valid") inner: InnerDirectives! innerNullable: InnerDirectives - thirdParty: ThirdParty @length(min: 0, max: 7, message: "not valid") + thirdParty: ThirdParty @length(min: 0, max: 7) } input InnerDirectives { @@ -116,7 +116,7 @@ type EmbeddedPointer { Title: String } -directive @length(min: Int!, max: Int) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION +directive @length(min: Int!, max: Int, message: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION directive @range(min: Int = 0, max: Int) on ARGUMENT_DEFINITION directive @custom on ARGUMENT_DEFINITION From dfec7b687fb5b61780941f51a53b195dadca8621 Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 25 Jun 2019 07:51:42 +0300 Subject: [PATCH 25/30] define fieldDefinition template --- codegen/field.gotpl | 48 ++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/codegen/field.gotpl b/codegen/field.gotpl index 9718a08aadf..08d05b1b482 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -59,28 +59,7 @@ ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) resTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - {{- if $field.IsResolver }} - return ec.resolvers.{{ $field.ShortInvocation }} - {{- else if $field.IsMap }} - switch v := {{$field.GoReceiverName}}[{{$field.Name|quote}}].(type) { - case {{$field.TypeReference.GO | ref}}: - return v, nil - case {{$field.TypeReference.Elem.GO | ref}}: - return &v, nil - case nil: - return ({{$field.TypeReference.GO | ref}})(nil), nil - default: - return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ $field.Name | quote}}) - } - {{- else if $field.IsMethod }} - {{- if $field.NoErr }} - return {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}), nil - {{- else }} - return {{$field.GoReceiverName}}.{{$field.GoFieldName}}({{ $field.CallArgs }}) - {{- end }} - {{- else if $field.IsVariable }} - return {{$field.GoReceiverName}}.{{$field.GoFieldName}}, nil - {{- end }} + {{ template "fieldDefinition" $field }} }) if resTmp == nil { {{- if $field.TypeReference.GQL.NonNull }} @@ -98,3 +77,28 @@ {{ end }} {{- end }}{{- end}} + +{{ define "fieldDefinition" }} + {{- if .IsResolver -}} + return ec.resolvers.{{ .ShortInvocation }} + {{- else if .IsMap -}} + switch v := {{.GoReceiverName}}[{{.Name|quote}}].(type) { + case {{.TypeReference.GO | ref}}: + return v, nil + case {{.TypeReference.Elem.GO | ref}}: + return &v, nil + case nil: + return ({{.TypeReference.GO | ref}})(nil), nil + default: + return nil, fmt.Errorf("unexpected type %T for field %s", v, {{ .Name | quote}}) + } + {{- else if .IsMethod -}} + {{- if .NoErr -}} + return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}), nil + {{- else -}} + return {{.GoReceiverName}}.{{.GoFieldName}}({{ .CallArgs }}) + {{- end -}} + {{- else if .IsVariable -}} + return {{.GoReceiverName}}.{{.GoFieldName}}, nil + {{- end }} +{{- end }} From 6e9d7dab9458106d2deed0e83910202d6625245b Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 25 Jun 2019 08:09:14 +0300 Subject: [PATCH 26/30] generate types directive by location --- codegen/args.go | 12 ++++++++++++ codegen/args.gotpl | 4 ++-- codegen/directive.go | 10 ++++++++-- codegen/directives.gotpl | 2 +- codegen/field.go | 16 +++++++++++++++- codegen/input.gotpl | 4 ++-- 6 files changed, 40 insertions(+), 8 deletions(-) diff --git a/codegen/args.go b/codegen/args.go index d1498bddb10..a77c15da622 100644 --- a/codegen/args.go +++ b/codegen/args.go @@ -26,6 +26,18 @@ type FieldArgument struct { Value interface{} // value set in Data } +//ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive +func (f *FieldArgument) ImplDirectives() []*Directive { + d := make([]*Directive, 0) + for i := range f.Directives { + if !f.Directives[i].IsBuiltin() && f.Directives[i].IsLocation(ast.LocationArgumentDefinition) { + d = append(d, f.Directives[i]) + } + } + + return d +} + func (f *FieldArgument) Stream() bool { return f.Object != nil && f.Object.Stream } diff --git a/codegen/args.gotpl b/codegen/args.gotpl index e7d30ef146e..b68da0203e5 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -5,10 +5,10 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, in map[string]inter {{- range $i, $arg := . }} var arg{{$i}} {{ $arg.TypeReference.GO | ref}} if tmp, ok := in[{{$arg.Name|quote}}]; ok { - {{- if $arg.Directives }} + {{- if $arg.ImplDirectives }} directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } {{ template "implDirectives" $arg }} - tmp, err = directive{{$arg.Directives|len}}(ctx) + tmp, err = directive{{$arg.ImplDirectives|len}}(ctx) if err != nil { return nil, err } diff --git a/codegen/directive.go b/codegen/directive.go index 0f61d060ca7..8656049dc5c 100644 --- a/codegen/directive.go +++ b/codegen/directive.go @@ -24,6 +24,11 @@ type Directive struct { Builtin bool } +//IsBuiltin check directive +func (d *Directive) IsBuiltin() bool { + return d.Builtin || d.Name == "skip" || d.Name == "include" || d.Name == "deprecated" +} + //IsLocation check location directive func (d *Directive) IsLocation(location ...ast.DirectiveLocation) bool { for _, l := range d.Locations { @@ -124,8 +129,9 @@ func (b *builder) getDirectives(list ast.DirectiveList) ([]*Directive, error) { }) } dirs[i] = &Directive{ - Name: d.Name, - Args: args, + Name: d.Name, + Args: args, + DirectiveDefinition: list[i].Definition, } } diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index 72498d1e9c3..7a1099a2ccf 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -1,5 +1,5 @@ {{ define "implDirectives" }} - {{- range $i, $directive := .Directives -}} + {{- range $i, $directive := .ImplDirectives -}} directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { {{- range $arg := $directive.Args }} {{- if notNil "Value" $arg }} diff --git a/codegen/field.go b/codegen/field.go index f5f7b22139c..87a8b69f16b 100644 --- a/codegen/field.go +++ b/codegen/field.go @@ -284,7 +284,21 @@ func (b *builder) findBindStructTarget(strukt *types.Struct, name string) (types } func (f *Field) HasDirectives() bool { - return len(f.Directives) > 0 + return len(f.ImplDirectives()) > 0 +} + +func (f *Field) ImplDirectives() []*Directive { + var d []*Directive + loc := ast.LocationFieldDefinition + if f.Object.IsInputType() { + loc = ast.LocationInputFieldDefinition + } + for i := range f.Directives { + if !f.Directives[i].IsBuiltin() && f.Directives[i].IsLocation(loc) { + d = append(d, f.Directives[i]) + } + } + return d } func (f *Field) IsReserved() bool { diff --git a/codegen/input.gotpl b/codegen/input.gotpl index 348037cc05e..47b01386228 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -16,10 +16,10 @@ {{- range $field := .Fields }} case {{$field.Name|quote}}: var err error - {{- if $field.Directives }} + {{- if $field.ImplDirectives }} directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } {{ template "implDirectives" $field }} - tmp, err := directive{{$field.Directives|len}}(ctx) + tmp, err := directive{{$field.ImplDirectives|len}}(ctx) if err != nil { return it, err } From 526beecb981b91e3e880050af655b4caa43f4fb4 Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 25 Jun 2019 09:23:04 +0300 Subject: [PATCH 27/30] update generate field --- codegen/args.go | 4 + codegen/args.gotpl | 4 +- codegen/directives.gotpl | 39 +- codegen/field.go | 4 + codegen/field.gotpl | 48 +- codegen/generated!.gotpl | 39 - codegen/input.gotpl | 4 +- codegen/testserver/generated.go | 2490 +++++++++++++++----- codegen/testserver/panics_test.go | 4 +- example/chat/generated.go | 737 ++++-- example/config/generated.go | 723 ++++-- example/dataloader/generated.go | 819 +++++-- example/fileupload/generated.go | 719 ++++-- example/scalars/generated.go | 775 ++++-- example/selection/generated.go | 715 ++++-- example/starwars/generated/exec.go | 1243 +++++++--- example/todo/generated.go | 778 ++++-- example/type-system-extension/generated.go | 766 ++++-- integration/generated.go | 801 +++++-- 19 files changed, 8255 insertions(+), 2457 deletions(-) diff --git a/codegen/args.go b/codegen/args.go index a77c15da622..905b4625eef 100644 --- a/codegen/args.go +++ b/codegen/args.go @@ -38,6 +38,10 @@ func (f *FieldArgument) ImplDirectives() []*Directive { return d } +func (f *FieldArgument) DirectiveObjName() string { + return "rawArgs" +} + func (f *FieldArgument) Stream() bool { return f.Object != nil && f.Object.Stream } diff --git a/codegen/args.gotpl b/codegen/args.gotpl index b68da0203e5..c76bf0f7648 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -1,10 +1,10 @@ {{ range $name, $args := .Args }} -func (ec *executionContext) {{ $name }}(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} {{- range $i, $arg := . }} var arg{{$i}} {{ $arg.TypeReference.GO | ref}} - if tmp, ok := in[{{$arg.Name|quote}}]; ok { + if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { {{- if $arg.ImplDirectives }} directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } {{ template "implDirectives" $arg }} diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index 7a1099a2ccf..67a0783e650 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -1,4 +1,4 @@ -{{ define "implDirectives" }} +{{ define "implDirectives" }}{{ $in := .DirectiveObjName }} {{- range $i, $directive := .ImplDirectives -}} directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { {{- range $arg := $directive.Args }} @@ -14,9 +14,9 @@ } {{- end }} {{- end }} - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs "in" $i }}) + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs $in $i }}) } - {{- end }} + {{- end -}} {{ end }} {{define "queryDirectives"}} @@ -102,3 +102,36 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as } } {{ end }} + +{{ if .Directives.LocationDirectives "FIELD" }} + func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { + {{- if .Directives.LocationDirectives "FIELD" }} + rctx := graphql.GetResolverContext(ctx) + for _, d := range rctx.Field.Directives { + switch d.Name { + {{- range $directive := .Directives.LocationDirectives "FIELD" }} + case "{{$directive.Name}}": + {{- if $directive.Args }} + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) + if err != nil { + ec.Error(ctx, err) + return nil + } + {{- end }} + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) + } + {{- end }} + } + } + {{- end }} + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res + } +{{ end }} diff --git a/codegen/field.go b/codegen/field.go index 87a8b69f16b..8d02664daee 100644 --- a/codegen/field.go +++ b/codegen/field.go @@ -287,6 +287,10 @@ func (f *Field) HasDirectives() bool { return len(f.ImplDirectives()) > 0 } +func (f *Field) DirectiveObjName() string { + return f.GoReceiverName +} + func (f *Field) ImplDirectives() []*Directive { var d []*Directive loc := ast.LocationFieldDefinition diff --git a/codegen/field.gotpl b/codegen/field.gotpl index 08d05b1b482..c0f6fcae0de 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -37,9 +37,15 @@ } } {{ else }} - func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) graphql.Marshaler { + func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Context, field graphql.CollectedField{{ if not $object.Root }}, obj {{$object.Reference | ref}}{{end}}) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func () { ec.Tracer.EndFieldExecution(ctx) }() + defer func () { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: {{$object.Name|quote}}, Field: field, @@ -57,10 +63,19 @@ rctx.Args = args {{- end }} ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - {{ template "fieldDefinition" $field }} - }) + {{- if $.Directives.LocationDirectives "FIELD" }} + resTmp := ec._fieldMiddleware(ctx, {{if $object.Root}}nil{{else}}obj{{end}}, func(rctx context.Context) (interface{}, error) { + {{ template "field" $field }} + }) + {{ else }} + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + {{ template "field" $field }} + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + {{- end }} if resTmp == nil { {{- if $field.TypeReference.GQL.NonNull }} if !ec.HasError(rctx) { @@ -78,6 +93,27 @@ {{- end }}{{- end}} +{{ define "field" }} + {{- if .HasDirectives -}} + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + {{ template "fieldDefinition" . }} + } + {{ template "implDirectives" . }} + tmp, err := directive{{.ImplDirectives|len}}(rctx) + if err != nil { + return nil, err + } + if data, ok := tmp.({{ .TypeReference.GO | ref }}) ; ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ .TypeReference.GO }}`, tmp) + {{- else -}} + ctx = rctx // use context from middleware stack in children + {{ template "fieldDefinition" . }} + {{- end -}} +{{ end }} + {{ define "fieldDefinition" }} {{- if .IsResolver -}} return ec.resolvers.{{ .ShortInvocation }} diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index dec7cbc8231..a95e57b625c 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -214,45 +214,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - {{- if .Directives }} - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Definition.Directives { - switch d.Name { - {{- range $directive := .Directives }} - case "{{$directive.Name}}": - if ec.directives.{{$directive.Name|ucFirst}} != nil { - {{- if $directive.Args }} - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.{{ $directive.ArgsFunc }}(ctx,rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - {{- end }} - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.{{$directive.Name|ucFirst}}({{$directive.CallArgs}}) - } - } - {{- end }} - } - } - {{- end }} - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") diff --git a/codegen/input.gotpl b/codegen/input.gotpl index 47b01386228..b51d53a2627 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -1,8 +1,8 @@ {{- range $input := .Inputs }} {{- if not .HasUnmarshal }} - func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, in interface{}) ({{.Type | ref}}, error) { + func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{.Type | ref}}, error) { var it {{.Type | ref}} - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) {{ range $field := .Fields}} {{- if $field.Default}} if _, present := asMap[{{$field.Name|quote}}] ; !present { diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 91f1fe4c2b4..4969e4bfe7f 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -1262,59 +1262,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Definition.Directives { - switch d.Name { - case "custom": - if ec.directives.Custom != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.Custom(ctx, obj, n) - } - } - case "length": - if ec.directives.Length != nil { - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_length_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.Length(ctx, obj, n, args["min"].(int), args["max"].(*int), args["message"].(*string)) - } - } - case "range": - if ec.directives.Range != nil { - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_range_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.Range(ctx, obj, n, args["min"].(*int), args["max"].(*int)) - } - } - } - } - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -1705,11 +1652,11 @@ scalar WrappedScalar // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_length_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := in["min"]; ok { + if tmp, ok := rawArgs["min"]; ok { arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err @@ -1717,7 +1664,7 @@ func (ec *executionContext) dir_length_args(ctx context.Context, in map[string]i } args["min"] = arg0 var arg1 *int - if tmp, ok := in["max"]; ok { + if tmp, ok := rawArgs["max"]; ok { arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -1725,7 +1672,7 @@ func (ec *executionContext) dir_length_args(ctx context.Context, in map[string]i } args["max"] = arg1 var arg2 *string - if tmp, ok := in["message"]; ok { + if tmp, ok := rawArgs["message"]; ok { arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { return nil, err @@ -1735,11 +1682,11 @@ func (ec *executionContext) dir_length_args(ctx context.Context, in map[string]i return args, nil } -func (ec *executionContext) dir_range_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := in["min"]; ok { + if tmp, ok := rawArgs["min"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -1747,7 +1694,7 @@ func (ec *executionContext) dir_range_args(ctx context.Context, in map[string]in } args["min"] = arg0 var arg1 *int - if tmp, ok := in["max"]; ok { + if tmp, ok := rawArgs["max"]; ok { arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -1757,11 +1704,11 @@ func (ec *executionContext) dir_range_args(ctx context.Context, in map[string]in return args, nil } -func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []MarshalPanic - if tmp, ok := in["u"]; ok { + if tmp, ok := rawArgs["u"]; ok { arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, tmp) if err != nil { return nil, err @@ -1771,11 +1718,11 @@ func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []MarshalPanic - if tmp, ok := in["u"]; ok { + if tmp, ok := rawArgs["u"]; ok { arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, tmp) if err != nil { return nil, err @@ -1785,11 +1732,11 @@ func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -1799,11 +1746,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { arg0, err = ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) if err != nil { return nil, err @@ -1813,11 +1760,11 @@ func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) @@ -1832,9 +1779,8 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, i if err != nil { return nil, err } - return ec.directives.Length(ctx, in, directive0, min, max, message) + return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - tmp, err = directive1(ctx) if err != nil { return nil, err @@ -1849,11 +1795,11 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, i return args, nil } -func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *InputDirectives - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) if err != nil { return nil, err @@ -1863,18 +1809,17 @@ func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context. return args, nil } -func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 InnerInput - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { - return ec.directives.Custom(ctx, in, directive0) + return ec.directives.Custom(ctx, rawArgs, directive0) } - tmp, err = directive1(ctx) if err != nil { return nil, err @@ -1889,11 +1834,11 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont return args, nil } -func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 InputDirectives - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) if err != nil { return nil, err @@ -1903,20 +1848,19 @@ func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { return nil, err } - return ec.directives.Range(ctx, in, directive0, min, nil) + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(ctx) if err != nil { return nil, err @@ -1929,16 +1873,15 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co } args["arg"] = arg0 var arg1 *int - if tmp, ok := in["arg2"]; ok { + if tmp, ok := rawArgs["arg2"]; ok { directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { return nil, err } - return ec.directives.Range(ctx, in, directive0, min, nil) + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(ctx) if err != nil { return nil, err @@ -1953,11 +1896,11 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return args, nil } -func (ec *executionContext) field_Query_fallback_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 FallbackToStringEncoding - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, tmp) if err != nil { return nil, err @@ -1967,11 +1910,11 @@ func (ec *executionContext) field_Query_fallback_args(ctx context.Context, in ma return args, nil } -func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []string - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { arg0, err = ec.unmarshalNString2ᚕstring(ctx, tmp) if err != nil { return nil, err @@ -1981,11 +1924,11 @@ func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 map[string]interface{} - if tmp, ok := in["input"]; ok { + if tmp, ok := rawArgs["input"]; ok { arg0, err = ec.unmarshalOChanges2map(ctx, tmp) if err != nil { return nil, err @@ -1995,11 +1938,11 @@ func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, in ma return args, nil } -func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 map[string]interface{} - if tmp, ok := in["in"]; ok { + if tmp, ok := rawArgs["in"]; ok { arg0, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) if err != nil { return nil, err @@ -2009,11 +1952,11 @@ func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Cont return args, nil } -func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 [][]*OuterInput - if tmp, ok := in["input"]; ok { + if tmp, ok := rawArgs["input"]; ok { arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, tmp) if err != nil { return nil, err @@ -2023,11 +1966,11 @@ func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, i return args, nil } -func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := in["arg"]; ok { + if tmp, ok := rawArgs["arg"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -2037,11 +1980,11 @@ func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field_Query_recursive_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *RecursiveInputSlice - if tmp, ok := in["input"]; ok { + if tmp, ok := rawArgs["input"]; ok { arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, tmp) if err != nil { return nil, err @@ -2051,11 +1994,11 @@ func (ec *executionContext) field_Query_recursive_args(ctx context.Context, in m return args, nil } -func (ec *executionContext) field_Query_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err @@ -2065,11 +2008,11 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, in map[st return args, nil } -func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["break"]; ok { + if tmp, ok := rawArgs["break"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2077,7 +2020,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["break"] = arg0 var arg1 string - if tmp, ok := in["default"]; ok { + if tmp, ok := rawArgs["default"]; ok { arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2085,7 +2028,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["default"] = arg1 var arg2 string - if tmp, ok := in["func"]; ok { + if tmp, ok := rawArgs["func"]; ok { arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2093,7 +2036,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["func"] = arg2 var arg3 string - if tmp, ok := in["interface"]; ok { + if tmp, ok := rawArgs["interface"]; ok { arg3, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2101,7 +2044,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["interface"] = arg3 var arg4 string - if tmp, ok := in["select"]; ok { + if tmp, ok := rawArgs["select"]; ok { arg4, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2109,7 +2052,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["select"] = arg4 var arg5 string - if tmp, ok := in["case"]; ok { + if tmp, ok := rawArgs["case"]; ok { arg5, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2117,7 +2060,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["case"] = arg5 var arg6 string - if tmp, ok := in["defer"]; ok { + if tmp, ok := rawArgs["defer"]; ok { arg6, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2125,7 +2068,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["defer"] = arg6 var arg7 string - if tmp, ok := in["go"]; ok { + if tmp, ok := rawArgs["go"]; ok { arg7, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2133,7 +2076,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["go"] = arg7 var arg8 string - if tmp, ok := in["map"]; ok { + if tmp, ok := rawArgs["map"]; ok { arg8, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2141,7 +2084,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["map"] = arg8 var arg9 string - if tmp, ok := in["struct"]; ok { + if tmp, ok := rawArgs["struct"]; ok { arg9, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2149,7 +2092,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["struct"] = arg9 var arg10 string - if tmp, ok := in["chan"]; ok { + if tmp, ok := rawArgs["chan"]; ok { arg10, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2157,7 +2100,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["chan"] = arg10 var arg11 string - if tmp, ok := in["else"]; ok { + if tmp, ok := rawArgs["else"]; ok { arg11, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2165,7 +2108,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["else"] = arg11 var arg12 string - if tmp, ok := in["goto"]; ok { + if tmp, ok := rawArgs["goto"]; ok { arg12, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2173,7 +2116,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["goto"] = arg12 var arg13 string - if tmp, ok := in["package"]; ok { + if tmp, ok := rawArgs["package"]; ok { arg13, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2181,7 +2124,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["package"] = arg13 var arg14 string - if tmp, ok := in["switch"]; ok { + if tmp, ok := rawArgs["switch"]; ok { arg14, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2189,7 +2132,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["switch"] = arg14 var arg15 string - if tmp, ok := in["const"]; ok { + if tmp, ok := rawArgs["const"]; ok { arg15, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2197,7 +2140,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["const"] = arg15 var arg16 string - if tmp, ok := in["fallthrough"]; ok { + if tmp, ok := rawArgs["fallthrough"]; ok { arg16, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2205,7 +2148,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["fallthrough"] = arg16 var arg17 string - if tmp, ok := in["if"]; ok { + if tmp, ok := rawArgs["if"]; ok { arg17, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2213,7 +2156,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["if"] = arg17 var arg18 string - if tmp, ok := in["range"]; ok { + if tmp, ok := rawArgs["range"]; ok { arg18, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2221,7 +2164,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["range"] = arg18 var arg19 string - if tmp, ok := in["type"]; ok { + if tmp, ok := rawArgs["type"]; ok { arg19, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2229,7 +2172,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["type"] = arg19 var arg20 string - if tmp, ok := in["continue"]; ok { + if tmp, ok := rawArgs["continue"]; ok { arg20, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2237,7 +2180,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["continue"] = arg20 var arg21 string - if tmp, ok := in["for"]; ok { + if tmp, ok := rawArgs["for"]; ok { arg21, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2245,7 +2188,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["for"] = arg21 var arg22 string - if tmp, ok := in["import"]; ok { + if tmp, ok := rawArgs["import"]; ok { arg22, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2253,7 +2196,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["import"] = arg22 var arg23 string - if tmp, ok := in["return"]; ok { + if tmp, ok := rawArgs["return"]; ok { arg23, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2261,7 +2204,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["return"] = arg23 var arg24 string - if tmp, ok := in["var"]; ok { + if tmp, ok := rawArgs["var"]; ok { arg24, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2269,7 +2212,7 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, } args["var"] = arg24 var arg25 string - if tmp, ok := in["_"]; ok { + if tmp, ok := rawArgs["_"]; ok { arg25, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -2279,11 +2222,11 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *ValidInput - if tmp, ok := in["input"]; ok { + if tmp, ok := rawArgs["input"]; ok { arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx, tmp) if err != nil { return nil, err @@ -2293,11 +2236,11 @@ func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context. return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -2307,11 +2250,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -2329,9 +2272,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) graphql.Marshaler { +func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedField, obj *A) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "A", Field: field, @@ -2340,10 +2289,14 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2356,9 +2309,15 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.CollectedField, obj *AIt) graphql.Marshaler { +func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.CollectedField, obj *AIt) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "AIt", Field: field, @@ -2367,10 +2326,14 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2383,9 +2346,15 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.CollectedField, obj *AbIt) graphql.Marshaler { +func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.CollectedField, obj *AbIt) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "AbIt", Field: field, @@ -2394,10 +2363,14 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2410,9 +2383,15 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.CollectedField, obj *Autobind) graphql.Marshaler { +func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, @@ -2421,10 +2400,14 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2437,9 +2420,15 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.CollectedField, obj *Autobind) graphql.Marshaler { +func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, @@ -2448,10 +2437,14 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int32, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2464,9 +2457,15 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C return ec.marshalNInt2int32(ctx, field.Selections, res) } -func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.CollectedField, obj *Autobind) graphql.Marshaler { +func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, @@ -2475,10 +2474,14 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int64, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2491,9 +2494,15 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C return ec.marshalNInt2int64(ctx, field.Selections, res) } -func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.CollectedField, obj *Autobind) graphql.Marshaler { +func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, @@ -2502,10 +2511,14 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdStr, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2518,9 +2531,15 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.CollectedField, obj *Autobind) graphql.Marshaler { +func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.CollectedField, obj *Autobind) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Autobind", Field: field, @@ -2529,10 +2548,14 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdInt, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2545,9 +2568,15 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedField, obj *B) graphql.Marshaler { +func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedField, obj *B) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "B", Field: field, @@ -2556,10 +2585,14 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2572,9 +2605,15 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) graphql.Marshaler { +func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Circle", Field: field, @@ -2583,10 +2622,14 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Radius, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2596,9 +2639,15 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co return ec.marshalOFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) graphql.Marshaler { +func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.CollectedField, obj *Circle) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Circle", Field: field, @@ -2607,10 +2656,14 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2620,9 +2673,15 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll return ec.marshalOFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) graphql.Marshaler { +func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql.CollectedField, obj *ContentPost) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Content_Post", Field: field, @@ -2631,10 +2690,14 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2644,9 +2707,15 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) graphql.Marshaler { +func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql.CollectedField, obj *ContentUser) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Content_User", Field: field, @@ -2655,10 +2724,14 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2668,9 +2741,15 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, field graphql.CollectedField, obj *EmbeddedDefaultScalar) graphql.Marshaler { +func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, field graphql.CollectedField, obj *EmbeddedDefaultScalar) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "EmbeddedDefaultScalar", Field: field, @@ -2679,10 +2758,14 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2692,9 +2775,15 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi return ec.marshalODefaultScalarImplementation2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) graphql.Marshaler { +func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "EmbeddedPointer", Field: field, @@ -2703,10 +2792,14 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2716,9 +2809,15 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) graphql.Marshaler { +func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field graphql.CollectedField, obj *EmbeddedPointerModel) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "EmbeddedPointer", Field: field, @@ -2727,10 +2826,14 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Title, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2740,9 +2843,15 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Error_id(ctx context.Context, field graphql.CollectedField, obj *Error) graphql.Marshaler { +func (ec *executionContext) _Error_id(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, @@ -2751,10 +2860,14 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2767,9 +2880,15 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) graphql.Marshaler { +func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, @@ -2778,10 +2897,14 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnNonRequiredField() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2791,9 +2914,15 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) graphql.Marshaler { +func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, @@ -2802,10 +2931,14 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnRequiredField() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2818,9 +2951,15 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) graphql.Marshaler { +func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field graphql.CollectedField, obj *Error) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Error", Field: field, @@ -2829,10 +2968,14 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NilOnRequiredField(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2845,9 +2988,15 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field return ec.marshalNString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) graphql.Marshaler { +func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, @@ -2856,10 +3005,14 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().A(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2872,9 +3025,15 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } -func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.CollectedField, obj *Errors) graphql.Marshaler { +func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, @@ -2883,10 +3042,14 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().B(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2899,9 +3062,15 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } -func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.CollectedField, obj *Errors) graphql.Marshaler { +func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, @@ -2910,10 +3079,14 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().C(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2926,9 +3099,15 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } -func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) graphql.Marshaler { +func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, @@ -2937,10 +3116,14 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().D(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2953,9 +3136,15 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } -func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.CollectedField, obj *Errors) graphql.Marshaler { +func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.CollectedField, obj *Errors) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Errors", Field: field, @@ -2964,10 +3153,14 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().E(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2980,10 +3173,16 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect return ec.marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } -func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field graphql.CollectedField, obj *ForcedResolver) graphql.Marshaler { +func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field graphql.CollectedField, obj *ForcedResolver) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() + rctx := &graphql.ResolverContext{ Object: "ForcedResolver", Field: field, Args: nil, @@ -2991,10 +3190,14 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ForcedResolver().Field(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3004,9 +3207,15 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra return ec.marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐCircle(ctx, field.Selections, res) } -func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.CollectedField, obj *InnerObject) graphql.Marshaler { +func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.CollectedField, obj *InnerObject) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "InnerObject", Field: field, @@ -3015,10 +3224,14 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3031,9 +3244,15 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field graphql.CollectedField, obj *invalid_packagename.InvalidIdentifier) graphql.Marshaler { +func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field graphql.CollectedField, obj *invalid_packagename.InvalidIdentifier) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "InvalidIdentifier", Field: field, @@ -3042,10 +3261,14 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3058,9 +3281,15 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedField, obj *introspection1.It) graphql.Marshaler { +func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedField, obj *introspection1.It) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "It", Field: field, @@ -3069,10 +3298,14 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3085,9 +3318,15 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.CollectedField, obj *LoopA) graphql.Marshaler { +func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.CollectedField, obj *LoopA) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "LoopA", Field: field, @@ -3096,10 +3335,14 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.B, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3112,9 +3355,15 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte return ec.marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopB(ctx, field.Selections, res) } -func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.CollectedField, obj *LoopB) graphql.Marshaler { +func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.CollectedField, obj *LoopB) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "LoopB", Field: field, @@ -3123,10 +3372,14 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.A, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3139,9 +3392,15 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte return ec.marshalNLoopA2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐLoopA(ctx, field.Selections, res) } -func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) graphql.Marshaler { +func (ec *executionContext) _Map_id(ctx context.Context, field graphql.CollectedField, obj *Map) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Map", Field: field, @@ -3150,10 +3409,14 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3166,9 +3429,15 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) graphql.Marshaler { +func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MapStringInterfaceType", Field: field, @@ -3177,7 +3446,7 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["a"].(type) { case *string: @@ -3190,6 +3459,10 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field return nil, fmt.Errorf("unexpected type %T for field %s", v, "a") } }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3199,9 +3472,15 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) graphql.Marshaler { +func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field graphql.CollectedField, obj map[string]interface{}) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MapStringInterfaceType", Field: field, @@ -3210,7 +3489,7 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["b"].(type) { case *int: @@ -3223,6 +3502,10 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field return nil, fmt.Errorf("unexpected type %T for field %s", v, "b") } }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3232,9 +3515,15 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field return ec.marshalOInt2ᚖint(ctx, field.Selections, res) } -func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) graphql.Marshaler { +func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", Field: field, @@ -3243,10 +3532,14 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ModelMethods().ResolverField(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3259,9 +3552,15 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) graphql.Marshaler { +func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", Field: field, @@ -3270,10 +3569,14 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NoContext(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3286,9 +3589,15 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) graphql.Marshaler { +func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field graphql.CollectedField, obj *ModelMethods) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ModelMethods", Field: field, @@ -3297,10 +3606,14 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.WithContext(ctx), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3313,9 +3626,15 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphql.CollectedField, obj *OuterObject) graphql.Marshaler { +func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphql.CollectedField, obj *OuterObject) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "OuterObject", Field: field, @@ -3324,10 +3643,14 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Inner, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3340,9 +3663,15 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq return ec.marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerObject(ctx, field.Selections, res) } -func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) graphql.Marshaler { +func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, @@ -3351,10 +3680,14 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3367,9 +3700,15 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) graphql.Marshaler { +func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, @@ -3378,10 +3717,14 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3394,9 +3737,15 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) graphql.Marshaler { +func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, @@ -3405,10 +3754,14 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3421,9 +3774,15 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) graphql.Marshaler { +func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, @@ -3432,10 +3791,14 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3448,9 +3811,15 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) graphql.Marshaler { +func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, field graphql.CollectedField, obj *OverlappingFields) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "OverlappingFields", Field: field, @@ -3459,10 +3828,14 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3475,9 +3848,15 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) graphql.Marshaler { +func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Panics", Field: field, @@ -3486,10 +3865,14 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3502,9 +3885,15 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, field.Selections, res) } -func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) graphql.Marshaler { +func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Panics", Field: field, @@ -3520,10 +3909,14 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FieldFuncMarshal(ctx, args["u"].([]MarshalPanic)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3536,9 +3929,15 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field return ec.marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, field.Selections, res) } -func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) graphql.Marshaler { +func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field graphql.CollectedField, obj *Panics) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Panics", Field: field, @@ -3554,10 +3953,14 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, args["u"].([]MarshalPanic)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3570,9 +3973,15 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql.CollectedField, obj *Primitive) graphql.Marshaler { +func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Primitive", Field: field, @@ -3581,10 +3990,14 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Primitive().Value(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3597,9 +4010,15 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphql.CollectedField, obj *Primitive) graphql.Marshaler { +func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphql.CollectedField, obj *Primitive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Primitive", Field: field, @@ -3608,10 +4027,14 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Squared(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3624,9 +4047,15 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) graphql.Marshaler { +func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", Field: field, @@ -3635,10 +4064,14 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Value(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3651,9 +4084,15 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) graphql.Marshaler { +func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", Field: field, @@ -3662,10 +4101,14 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Doubled(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3678,9 +4121,15 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) graphql.Marshaler { +func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field graphql.CollectedField, obj *PrimitiveString) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "PrimitiveString", Field: field, @@ -3689,10 +4138,14 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Len(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3705,9 +4158,15 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3716,10 +4175,14 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InvalidIdentifier(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3729,9 +4192,15 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field return ec.marshalOInvalidIdentifier2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋinvalidᚑpackagenameᚐInvalidIdentifier(ctx, field.Selections, res) } -func (ec *executionContext) _Query_collision(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_collision(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3740,10 +4209,14 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Collision(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3753,9 +4226,15 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. return ec.marshalOIt2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋintrospectionᚐIt(ctx, field.Selections, res) } -func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3771,10 +4250,14 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapInput(rctx, args["input"].(map[string]interface{})) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3784,9 +4267,15 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3802,10 +4291,14 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Recursive(rctx, args["input"].(*RecursiveInputSlice)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3815,9 +4308,15 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3833,10 +4332,14 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedInputs(rctx, args["input"].([][]*OuterInput)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3846,9 +4349,15 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3857,10 +4366,14 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedOutputs(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3870,9 +4383,15 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap return ec.marshalOOuterObject2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterObject(ctx, field.Selections, res) } -func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3881,10 +4400,14 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Shapes(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3894,9 +4417,15 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col return ec.marshalOShape2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx, field.Selections, res) } -func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3905,10 +4434,14 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ModelMethods(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3918,9 +4451,15 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph return ec.marshalOModelMethods2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐModelMethods(ctx, field.Selections, res) } -func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3936,10 +4475,14 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3952,9 +4495,15 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return ec.marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -3970,10 +4519,14 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NullableArg(rctx, args["arg"].(*int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -3983,9 +4536,15 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4001,10 +4560,14 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveArg(rctx, args["arg"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4014,9 +4577,15 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4032,10 +4601,14 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4045,9 +4618,15 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4063,10 +4642,14 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputNullable(rctx, args["arg"].(*InputDirectives)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4076,9 +4659,15 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_directiveInput(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_directiveInput(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4094,10 +4683,14 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInput(rctx, args["arg"].(InputDirectives)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4107,9 +4700,15 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4125,10 +4724,14 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputType(rctx, args["arg"].(InnerInput)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4138,9 +4741,15 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4156,10 +4765,14 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InputSlice(rctx, args["arg"].([]string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4172,9 +4785,15 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4183,10 +4802,14 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ShapeUnion(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4199,9 +4822,15 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql return ec.marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShapeUnion(ctx, field.Selections, res) } -func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4210,10 +4839,14 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Autobind(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4223,9 +4856,15 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C return ec.marshalOAutobind2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐAutobind(ctx, field.Selections, res) } -func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4234,10 +4873,14 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DeprecatedField(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4250,9 +4893,15 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4261,10 +4910,14 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Overlapping(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4274,9 +4927,15 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq return ec.marshalOOverlappingFields2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOverlappingFields(ctx, field.Selections, res) } -func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4292,10 +4951,14 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapStringInterface(rctx, args["in"].(map[string]interface{})) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4305,9 +4968,15 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field return ec.marshalOMapStringInterfaceType2map(ctx, field.Selections, res) } -func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4316,10 +4985,14 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ErrorBubble(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4329,9 +5002,15 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq return ec.marshalOError2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐError(ctx, field.Selections, res) } -func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4340,10 +5019,14 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Errors(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4353,9 +5036,15 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col return ec.marshalOErrors2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐErrors(ctx, field.Selections, res) } -func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4364,10 +5053,14 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Valid(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4380,9 +5073,15 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4391,10 +5090,14 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Panics(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4404,9 +5107,15 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col return ec.marshalOPanics2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPanics(ctx, field.Selections, res) } -func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4415,10 +5124,14 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveObject(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4431,9 +5144,15 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr return ec.marshalNPrimitive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitive(ctx, field.Selections, res) } -func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4442,10 +5161,14 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveStringObject(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4458,9 +5181,15 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi return ec.marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐPrimitiveString(ctx, field.Selections, res) } -func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4476,10 +5205,14 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DefaultScalar(rctx, args["arg"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4492,9 +5225,15 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap return ec.marshalNDefaultScalarImplementation2string(ctx, field.Selections, res) } -func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4503,10 +5242,14 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Slices(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4516,9 +5259,15 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col return ec.marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSlices(ctx, field.Selections, res) } -func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4527,10 +5276,14 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ScalarSlice(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4543,9 +5296,15 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq return ec.marshalNBytes2ᚕbyte(ctx, field.Selections, res) } -func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4561,10 +5320,14 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Fallback(rctx, args["arg"].(FallbackToStringEncoding)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4577,9 +5340,15 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C return ec.marshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, field.Selections, res) } -func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4588,10 +5357,14 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().OptionalUnion(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4601,9 +5374,15 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap return ec.marshalOTestUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐTestUnion(ctx, field.Selections, res) } -func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_validType(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4612,10 +5391,14 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ValidType(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4625,9 +5408,15 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. return ec.marshalOValidType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidType(ctx, field.Selections, res) } -func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4636,10 +5425,14 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedStruct(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4652,9 +5445,15 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap return ec.marshalNWrappedStruct2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedStruct(ctx, field.Selections, res) } -func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4663,10 +5462,14 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedScalar(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4679,9 +5482,15 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap return ec.marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4697,10 +5506,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4710,9 +5523,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -4721,10 +5540,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4734,9 +5557,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) graphql.Marshaler { +func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Rectangle", Field: field, @@ -4745,10 +5574,14 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Length, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4758,9 +5591,15 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql return ec.marshalOFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) graphql.Marshaler { +func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Rectangle", Field: field, @@ -4769,10 +5608,14 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Width, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4782,9 +5625,15 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. return ec.marshalOFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) graphql.Marshaler { +func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.CollectedField, obj *Rectangle) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Rectangle", Field: field, @@ -4793,10 +5642,14 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4806,9 +5659,15 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C return ec.marshalOFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) graphql.Marshaler { +func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, @@ -4817,10 +5676,14 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test1, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4830,9 +5693,15 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col return ec.marshalOString2ᚕᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) graphql.Marshaler { +func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, @@ -4841,10 +5710,14 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test2, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -4854,9 +5727,15 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) graphql.Marshaler { +func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, @@ -4865,10 +5744,14 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test3, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4881,9 +5764,15 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col return ec.marshalNString2ᚕᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) graphql.Marshaler { +func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.CollectedField, obj *Slices) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Slices", Field: field, @@ -4892,10 +5781,14 @@ func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test4, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4964,9 +5857,15 @@ func (ec *executionContext) _Subscription_initPayload(ctx context.Context, field } } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -4975,10 +5874,14 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4991,9 +5894,15 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _User_friends(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { +func (ec *executionContext) _User_friends(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -5002,10 +5911,14 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Friends(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5018,9 +5931,15 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col return ec.marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { +func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -5029,10 +5948,14 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5045,9 +5968,15 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { +func (ec *executionContext) _User_updated(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -5056,10 +5985,14 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Updated, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5069,9 +6002,15 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col return ec.marshalOTime2ᚖtimeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) graphql.Marshaler { +func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, @@ -5080,10 +6019,14 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCase, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5096,9 +6039,15 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) graphql.Marshaler { +func (ec *executionContext) _ValidType_different_case(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, @@ -5107,10 +6056,14 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCaseOld, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5123,9 +6076,15 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) graphql.Marshaler { +func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, @@ -5141,10 +6100,14 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidInputKeywords, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5157,9 +6120,15 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) graphql.Marshaler { +func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field graphql.CollectedField, obj *ValidType) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "ValidType", Field: field, @@ -5175,10 +6144,14 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidArgs, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5191,9 +6164,15 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) graphql.Marshaler { +func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graphql.CollectedField, obj *WrappedStruct) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "WrappedStruct", Field: field, @@ -5202,10 +6181,14 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5218,9 +6201,15 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) graphql.Marshaler { +func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.CollectedField, obj *XXIt) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "XXIt", Field: field, @@ -5229,10 +6218,14 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5245,9 +6238,15 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.CollectedField, obj *XxIt) graphql.Marshaler { +func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.CollectedField, obj *XxIt) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "XxIt", Field: field, @@ -5256,10 +6255,14 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5272,9 +6275,15 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -5283,10 +6292,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5299,9 +6312,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -5310,10 +6329,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5323,9 +6346,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -5334,10 +6363,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5350,9 +6383,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -5361,10 +6400,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5377,9 +6420,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -5388,10 +6437,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5404,9 +6457,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -5415,10 +6474,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5428,9 +6491,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -5439,10 +6508,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5455,9 +6528,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -5466,10 +6545,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5479,9 +6562,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -5490,10 +6579,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5506,9 +6599,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -5517,10 +6616,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5530,9 +6633,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -5541,10 +6650,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5557,9 +6670,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -5568,10 +6687,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5584,9 +6707,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -5595,10 +6724,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5611,9 +6744,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -5622,10 +6761,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5635,9 +6778,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -5646,10 +6795,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5662,9 +6815,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -5673,10 +6832,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5686,9 +6849,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -5697,10 +6866,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5713,9 +6886,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -5724,10 +6903,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5737,9 +6920,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -5748,10 +6937,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5764,9 +6957,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -5775,10 +6974,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5791,9 +6994,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -5802,10 +7011,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5815,9 +7028,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -5826,10 +7045,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5839,9 +7062,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -5850,10 +7079,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5866,9 +7099,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -5877,10 +7116,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5893,9 +7136,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -5904,10 +7153,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5917,9 +7170,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -5928,10 +7187,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5941,9 +7204,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -5959,10 +7228,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5972,9 +7245,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -5983,10 +7262,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -5996,9 +7279,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -6007,10 +7296,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -6020,9 +7313,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -6038,10 +7337,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -6051,9 +7354,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -6062,10 +7371,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -6075,9 +7388,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -6086,10 +7405,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -6099,9 +7422,15 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.CollectedField, obj *AsdfIt) graphql.Marshaler { +func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.CollectedField, obj *AsdfIt) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "asdfIt", Field: field, @@ -6110,10 +7439,14 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6126,9 +7459,15 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.CollectedField, obj *IIt) graphql.Marshaler { +func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.CollectedField, obj *IIt) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "iIt", Field: field, @@ -6137,10 +7476,14 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6157,9 +7500,9 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, in interface{}) (InnerDirectives, error) { +func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, obj interface{}) (InnerDirectives, error) { var it InnerDirectives - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6175,9 +7518,8 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, i if err != nil { return nil, err } - return ec.directives.Length(ctx, in, directive0, min, nil, message) + return ec.directives.Length(ctx, obj, directive0, min, nil, message) } - tmp, err := directive1(ctx) if err != nil { return it, err @@ -6193,9 +7535,9 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, i return it, nil } -func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, in interface{}) (InnerInput, error) { +func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, obj interface{}) (InnerInput, error) { var it InnerInput - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6211,9 +7553,9 @@ func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, in int return it, nil } -func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, in interface{}) (InputDirectives, error) { +func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, obj interface{}) (InputDirectives, error) { var it InputDirectives - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6233,9 +7575,8 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, i if err != nil { return nil, err } - return ec.directives.Length(ctx, in, directive0, min, max, message) + return ec.directives.Length(ctx, obj, directive0, min, max, message) } - tmp, err := directive1(ctx) if err != nil { return it, err @@ -6271,9 +7612,8 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, i if err != nil { return nil, err } - return ec.directives.Length(ctx, in, directive0, min, max, nil) + return ec.directives.Length(ctx, obj, directive0, min, max, nil) } - tmp, err := directive1(ctx) if err != nil { return it, err @@ -6289,9 +7629,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, i return it, nil } -func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, in interface{}) (OuterInput, error) { +func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, obj interface{}) (OuterInput, error) { var it OuterInput - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6307,9 +7647,9 @@ func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, in int return it, nil } -func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Context, in interface{}) (RecursiveInputSlice, error) { +func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Context, obj interface{}) (RecursiveInputSlice, error) { var it RecursiveInputSlice - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { @@ -6325,9 +7665,9 @@ func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Contex return it, nil } -func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, in interface{}) (ValidInput, error) { +func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, obj interface{}) (ValidInput, error) { var it ValidInput - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/codegen/testserver/panics_test.go b/codegen/testserver/panics_test.go index ed7ce713cbb..1972dffed9c 100644 --- a/codegen/testserver/panics_test.go +++ b/codegen/testserver/panics_test.go @@ -37,14 +37,14 @@ func TestPanics(t *testing.T) { var resp interface{} err := c.Post(`query { panics { argUnmarshal(u: ["aa", "bb"]) } }`, &resp) - require.EqualError(t, err, "http 422: {\"errors\":[{\"message\":\"internal system error\"}],\"data\":null}") + require.EqualError(t, err, "[{\"message\":\"internal system error\",\"path\":[\"panics\",\"argUnmarshal\"]}]") }) t.Run("panics in funcs unmarshal return errors", func(t *testing.T) { var resp interface{} err := c.Post(`query { panics { fieldFuncMarshal(u: ["aa", "bb"]) } }`, &resp) - require.EqualError(t, err, "http 422: {\"errors\":[{\"message\":\"internal system error\"}],\"data\":null}") + require.EqualError(t, err, "[{\"message\":\"internal system error\",\"path\":[\"panics\",\"fieldFuncMarshal\"]}]") }) t.Run("panics in funcs marshal return errors", func(t *testing.T) { diff --git a/example/chat/generated.go b/example/chat/generated.go index 30968d8c717..d57ea54ac53 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -251,39 +251,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Definition.Directives { - switch d.Name { - case "user": - if ec.directives.User != nil { - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_user_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.User(ctx, obj, n, args["username"].(string)) - } - } - } - } - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -333,11 +300,11 @@ directive @user(username: String!) on SUBSCRIPTION // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["username"]; ok { + if tmp, ok := rawArgs["username"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -347,11 +314,11 @@ func (ec *executionContext) dir_user_args(ctx context.Context, in map[string]int return args, nil } -func (ec *executionContext) field_Mutation_post_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["text"]; ok { + if tmp, ok := rawArgs["text"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -359,7 +326,7 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, in map } args["text"] = arg0 var arg1 string - if tmp, ok := in["username"]; ok { + if tmp, ok := rawArgs["username"]; ok { arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -367,7 +334,7 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, in map } args["username"] = arg1 var arg2 string - if tmp, ok := in["roomName"]; ok { + if tmp, ok := rawArgs["roomName"]; ok { arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -377,11 +344,11 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, in map return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -391,11 +358,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_room_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -405,11 +372,11 @@ func (ec *executionContext) field_Query_room_args(ctx context.Context, in map[st return args, nil } -func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["roomName"]; ok { + if tmp, ok := rawArgs["roomName"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -419,11 +386,11 @@ func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Con return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -433,11 +400,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -489,9 +456,15 @@ func (ec *executionContext) _subscriptionMiddleware(ctx context.Context, obj *as // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) graphql.Marshaler { +func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Chatroom", Field: field, @@ -500,10 +473,14 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -516,9 +493,15 @@ func (ec *executionContext) _Chatroom_name(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) graphql.Marshaler { +func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphql.CollectedField, obj *Chatroom) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Chatroom", Field: field, @@ -527,10 +510,14 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Messages, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -543,9 +530,15 @@ func (ec *executionContext) _Chatroom_messages(ctx context.Context, field graphq return ec.marshalNMessage2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) } -func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) graphql.Marshaler { +func (ec *executionContext) _Message_id(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, @@ -554,10 +547,14 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -570,9 +567,15 @@ func (ec *executionContext) _Message_id(ctx context.Context, field graphql.Colle return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) graphql.Marshaler { +func (ec *executionContext) _Message_text(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, @@ -581,10 +584,14 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -597,9 +604,15 @@ func (ec *executionContext) _Message_text(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) graphql.Marshaler { +func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, @@ -608,10 +621,14 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedBy, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -624,9 +641,15 @@ func (ec *executionContext) _Message_createdBy(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) graphql.Marshaler { +func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphql.CollectedField, obj *Message) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Message", Field: field, @@ -635,10 +658,14 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.CreatedAt, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -651,9 +678,15 @@ func (ec *executionContext) _Message_createdAt(ctx context.Context, field graphq return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -669,10 +702,14 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().Post(rctx, args["text"].(string), args["username"].(string), args["roomName"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -685,9 +722,15 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co return ec.marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐMessage(ctx, field.Selections, res) } -func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_room(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -703,10 +746,14 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Room(rctx, args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -716,9 +763,15 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle return ec.marshalOChatroom2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋchatᚐChatroom(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -734,10 +787,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -747,9 +804,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -758,10 +821,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -805,9 +872,15 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel } } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -816,10 +889,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -832,9 +909,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -843,10 +926,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -856,9 +943,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -867,10 +960,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -883,9 +980,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -894,10 +997,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -910,9 +1017,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -921,10 +1034,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -937,9 +1054,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -948,10 +1071,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -961,9 +1088,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -972,10 +1105,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -988,9 +1125,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -999,10 +1142,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1012,9 +1159,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1023,10 +1176,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1039,9 +1196,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1050,10 +1213,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1063,9 +1230,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1074,10 +1247,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1090,9 +1267,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1101,10 +1284,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1117,9 +1304,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1128,10 +1321,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1144,9 +1341,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1155,10 +1358,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1168,9 +1375,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1179,10 +1392,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1195,9 +1412,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1206,10 +1429,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1219,9 +1446,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1230,10 +1463,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1246,9 +1483,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1257,10 +1500,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1270,9 +1517,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1281,10 +1534,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1297,9 +1554,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1308,10 +1571,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1324,9 +1591,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1335,10 +1608,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1348,9 +1625,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1359,10 +1642,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1372,9 +1659,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1383,10 +1676,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1399,9 +1696,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1410,10 +1713,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1426,9 +1733,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1437,10 +1750,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1450,9 +1767,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1461,10 +1784,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1474,9 +1801,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1492,10 +1825,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1505,9 +1842,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1516,10 +1859,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1529,9 +1876,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1540,10 +1893,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1553,9 +1910,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1571,10 +1934,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1584,9 +1951,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1595,10 +1968,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1608,9 +1985,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1619,10 +2002,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } diff --git a/example/config/generated.go b/example/config/generated.go index 32975caa38a..396226c1798 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -205,21 +205,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -268,11 +253,11 @@ input NewTodo { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 NewTodo - if tmp, ok := in["input"]; ok { + if tmp, ok := rawArgs["input"]; ok { arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(ctx, tmp) if err != nil { return nil, err @@ -282,11 +267,11 @@ func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -296,11 +281,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -310,11 +295,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -332,9 +317,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -350,10 +341,14 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateTodo(rctx, args["input"].(NewTodo)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -366,9 +361,15 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -377,10 +378,14 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Todos(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -393,9 +398,15 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -411,10 +422,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -424,9 +439,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -435,10 +456,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -448,9 +473,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -459,10 +490,14 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Todo().ID(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -475,9 +510,15 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -486,10 +527,14 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DatabaseID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -502,9 +547,15 @@ func (ec *executionContext) _Todo_databaseId(ctx context.Context, field graphql. return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -513,10 +564,14 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -529,9 +584,15 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -540,10 +601,14 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Done, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -556,9 +621,15 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -567,10 +638,14 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -583,9 +658,15 @@ func (ec *executionContext) _Todo_user(ctx context.Context, field graphql.Collec return ec.marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -594,10 +675,14 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -610,9 +695,15 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) graphql.Marshaler { +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -621,10 +712,14 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FullName(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -637,9 +732,15 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -648,10 +749,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -664,9 +769,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -675,10 +786,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -688,9 +803,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -699,10 +820,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -715,9 +840,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -726,10 +857,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -742,9 +877,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -753,10 +894,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -769,9 +914,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -780,10 +931,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -793,9 +948,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -804,10 +965,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -820,9 +985,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -831,10 +1002,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -844,9 +1019,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -855,10 +1036,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -871,9 +1056,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -882,10 +1073,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -895,9 +1090,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -906,10 +1107,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -922,9 +1127,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -933,10 +1144,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -949,9 +1164,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -960,10 +1181,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -976,9 +1201,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -987,10 +1218,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1000,9 +1235,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1011,10 +1252,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1027,9 +1272,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1038,10 +1289,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1051,9 +1306,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1062,10 +1323,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1078,9 +1343,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1089,10 +1360,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1102,9 +1377,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1113,10 +1394,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1129,9 +1414,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1140,10 +1431,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1156,9 +1451,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1167,10 +1468,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1180,9 +1485,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1191,10 +1502,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1204,9 +1519,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1215,10 +1536,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1231,9 +1556,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1242,10 +1573,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1258,9 +1593,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1269,10 +1610,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1282,9 +1627,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1293,10 +1644,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1306,9 +1661,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1324,10 +1685,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1337,9 +1702,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1348,10 +1719,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1361,9 +1736,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1372,10 +1753,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1385,9 +1770,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1403,10 +1794,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1416,9 +1811,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1427,10 +1828,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1440,9 +1845,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1451,10 +1862,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1468,9 +1883,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, in interface{}) (NewTodo, error) { +func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, obj interface{}) (NewTodo, error) { var it NewTodo - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 63eea24f162..c4e04e815de 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -252,21 +252,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -321,11 +306,11 @@ scalar Time // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -335,11 +320,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []int - if tmp, ok := in["customerIds"]; ok { + if tmp, ok := rawArgs["customerIds"]; ok { arg0, err = ec.unmarshalOInt2ᚕint(ctx, tmp) if err != nil { return nil, err @@ -349,11 +334,11 @@ func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, in m return args, nil } -func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 [][]int - if tmp, ok := in["customerIds"]; ok { + if tmp, ok := rawArgs["customerIds"]; ok { arg0, err = ec.unmarshalOInt2ᚕᚕint(ctx, tmp) if err != nil { return nil, err @@ -363,11 +348,11 @@ func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, in m return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -377,11 +362,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -399,9 +384,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) graphql.Marshaler { +func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, @@ -410,10 +401,14 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -426,9 +421,15 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Address_street(ctx context.Context, field graphql.CollectedField, obj *Address) graphql.Marshaler { +func (ec *executionContext) _Address_street(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, @@ -437,10 +438,14 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Street, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -453,9 +458,15 @@ func (ec *executionContext) _Address_street(ctx context.Context, field graphql.C return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Address_country(ctx context.Context, field graphql.CollectedField, obj *Address) graphql.Marshaler { +func (ec *executionContext) _Address_country(ctx context.Context, field graphql.CollectedField, obj *Address) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, @@ -464,10 +475,14 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Country, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -480,9 +495,15 @@ func (ec *executionContext) _Address_country(ctx context.Context, field graphql. return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.CollectedField, obj *Customer) graphql.Marshaler { +func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, @@ -491,10 +512,14 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -507,9 +532,15 @@ func (ec *executionContext) _Customer_id(ctx context.Context, field graphql.Coll return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.CollectedField, obj *Customer) graphql.Marshaler { +func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, @@ -518,10 +549,14 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -534,9 +569,15 @@ func (ec *executionContext) _Customer_name(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Customer_address(ctx context.Context, field graphql.CollectedField, obj *Customer) graphql.Marshaler { +func (ec *executionContext) _Customer_address(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, @@ -545,10 +586,14 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Address(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -558,9 +603,15 @@ func (ec *executionContext) _Customer_address(ctx context.Context, field graphql return ec.marshalOAddress2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐAddress(ctx, field.Selections, res) } -func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql.CollectedField, obj *Customer) graphql.Marshaler { +func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql.CollectedField, obj *Customer) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Customer", Field: field, @@ -569,10 +620,14 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Customer().Orders(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -582,9 +637,15 @@ func (ec *executionContext) _Customer_orders(ctx context.Context, field graphql. return ec.marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐOrder(ctx, field.Selections, res) } -func (ec *executionContext) _Item_name(ctx context.Context, field graphql.CollectedField, obj *Item) graphql.Marshaler { +func (ec *executionContext) _Item_name(ctx context.Context, field graphql.CollectedField, obj *Item) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Item", Field: field, @@ -593,10 +654,14 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -609,9 +674,15 @@ func (ec *executionContext) _Item_name(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Order_id(ctx context.Context, field graphql.CollectedField, obj *Order) graphql.Marshaler { +func (ec *executionContext) _Order_id(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, @@ -620,10 +691,14 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -636,9 +711,15 @@ func (ec *executionContext) _Order_id(ctx context.Context, field graphql.Collect return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Order_date(ctx context.Context, field graphql.CollectedField, obj *Order) graphql.Marshaler { +func (ec *executionContext) _Order_date(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, @@ -647,10 +728,14 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Date, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -663,9 +748,15 @@ func (ec *executionContext) _Order_date(ctx context.Context, field graphql.Colle return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.CollectedField, obj *Order) graphql.Marshaler { +func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, @@ -674,10 +765,14 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Amount, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -690,9 +785,15 @@ func (ec *executionContext) _Order_amount(ctx context.Context, field graphql.Col return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Order_items(ctx context.Context, field graphql.CollectedField, obj *Order) graphql.Marshaler { +func (ec *executionContext) _Order_items(ctx context.Context, field graphql.CollectedField, obj *Order) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Order", Field: field, @@ -701,10 +802,14 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Order().Items(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -714,9 +819,15 @@ func (ec *executionContext) _Order_items(ctx context.Context, field graphql.Coll return ec.marshalOItem2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐItem(ctx, field.Selections, res) } -func (ec *executionContext) _Query_customers(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_customers(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -725,10 +836,14 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Customers(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -738,9 +853,15 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. return ec.marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } -func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -756,10 +877,14 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture1d(rctx, args["customerIds"].([]int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -769,9 +894,15 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. return ec.marshalOCustomer2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } -func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -787,10 +918,14 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Torture2d(rctx, args["customerIds"].([][]int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -800,9 +935,15 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. return ec.marshalOCustomer2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋdataloaderᚐCustomer(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -818,10 +959,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -831,9 +976,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -842,10 +993,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -855,9 +1010,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -866,10 +1027,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -882,9 +1047,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -893,10 +1064,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -906,9 +1081,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -917,10 +1098,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -933,9 +1118,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -944,10 +1135,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -960,9 +1155,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -971,10 +1172,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -987,9 +1192,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -998,10 +1209,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1011,9 +1226,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -1022,10 +1243,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1038,9 +1263,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -1049,10 +1280,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1062,9 +1297,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1073,10 +1314,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1089,9 +1334,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1100,10 +1351,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1113,9 +1368,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1124,10 +1385,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1140,9 +1405,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1151,10 +1422,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1167,9 +1442,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1178,10 +1459,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1194,9 +1479,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1205,10 +1496,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1218,9 +1513,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1229,10 +1530,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1245,9 +1550,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1256,10 +1567,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1269,9 +1584,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1280,10 +1601,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1296,9 +1621,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1307,10 +1638,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1320,9 +1655,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1331,10 +1672,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1347,9 +1692,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1358,10 +1709,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1374,9 +1729,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1385,10 +1746,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1398,9 +1763,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1409,10 +1780,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1422,9 +1797,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1433,10 +1814,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1449,9 +1834,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1460,10 +1851,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1476,9 +1871,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1487,10 +1888,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1500,9 +1905,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1511,10 +1922,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1524,9 +1939,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1542,10 +1963,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1555,9 +1980,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1566,10 +1997,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1579,9 +2014,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1590,10 +2031,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1603,9 +2048,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1621,10 +2072,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1634,9 +2089,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1645,10 +2106,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1658,9 +2123,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1669,10 +2140,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 9d0bb34fe9c..51d089f0625 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -209,21 +209,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -275,11 +260,11 @@ type Mutation { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []*model.UploadFile - if tmp, ok := in["req"]; ok { + if tmp, ok := rawArgs["req"]; ok { arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) if err != nil { return nil, err @@ -289,11 +274,11 @@ func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx co return args, nil } -func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 []*graphql.Upload - if tmp, ok := in["files"]; ok { + if tmp, ok := rawArgs["files"]; ok { arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) if err != nil { return nil, err @@ -303,11 +288,11 @@ func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 model.UploadFile - if tmp, ok := in["req"]; ok { + if tmp, ok := rawArgs["req"]; ok { arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) if err != nil { return nil, err @@ -317,11 +302,11 @@ func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx cont return args, nil } -func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 graphql.Upload - if tmp, ok := in["file"]; ok { + if tmp, ok := rawArgs["file"]; ok { arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) if err != nil { return nil, err @@ -331,11 +316,11 @@ func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -345,11 +330,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -359,11 +344,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -381,9 +366,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) graphql.Marshaler { +func (ec *executionContext) _File_id(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "File", Field: field, @@ -392,10 +383,14 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -408,9 +403,15 @@ func (ec *executionContext) _File_id(ctx context.Context, field graphql.Collecte return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _File_name(ctx context.Context, field graphql.CollectedField, obj *model.File) graphql.Marshaler { +func (ec *executionContext) _File_name(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "File", Field: field, @@ -419,10 +420,14 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -435,9 +440,15 @@ func (ec *executionContext) _File_name(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _File_content(ctx context.Context, field graphql.CollectedField, obj *model.File) graphql.Marshaler { +func (ec *executionContext) _File_content(ctx context.Context, field graphql.CollectedField, obj *model.File) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "File", Field: field, @@ -446,10 +457,14 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Content, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -462,9 +477,15 @@ func (ec *executionContext) _File_content(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -480,10 +501,14 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUpload(rctx, args["file"].(graphql.Upload)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -496,9 +521,15 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr return ec.marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } -func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -514,10 +545,14 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().SingleUploadWithPayload(rctx, args["req"].(model.UploadFile)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -530,9 +565,15 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex return ec.marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } -func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -548,10 +589,14 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUpload(rctx, args["files"].([]*graphql.Upload)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -564,9 +609,15 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field return ec.marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } -func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -582,10 +633,14 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().MultipleUploadWithPayload(rctx, args["req"].([]*model.UploadFile)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -598,9 +653,15 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont return ec.marshalNFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐFile(ctx, field.Selections, res) } -func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -609,10 +670,14 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Empty(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -625,9 +690,15 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -643,10 +714,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -656,9 +731,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -667,10 +748,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -680,9 +765,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -691,10 +782,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -707,9 +802,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -718,10 +819,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -731,9 +836,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -742,10 +853,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -758,9 +873,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -769,10 +890,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -785,9 +910,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -796,10 +927,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -812,9 +947,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -823,10 +964,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -836,9 +981,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -847,10 +998,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -863,9 +1018,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -874,10 +1035,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -887,9 +1052,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -898,10 +1069,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -914,9 +1089,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -925,10 +1106,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -938,9 +1123,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -949,10 +1140,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -965,9 +1160,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -976,10 +1177,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -992,9 +1197,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1003,10 +1214,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1019,9 +1234,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1030,10 +1251,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1043,9 +1268,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1054,10 +1285,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1070,9 +1305,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1081,10 +1322,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1094,9 +1339,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1105,10 +1356,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1121,9 +1376,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1132,10 +1393,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1145,9 +1410,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1156,10 +1427,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1172,9 +1447,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1183,10 +1464,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1199,9 +1484,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1210,10 +1501,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1223,9 +1518,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1234,10 +1535,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1247,9 +1552,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1258,10 +1569,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1274,9 +1589,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1285,10 +1606,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1301,9 +1626,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1312,10 +1643,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1325,9 +1660,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1336,10 +1677,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1349,9 +1694,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1367,10 +1718,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1380,9 +1735,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1391,10 +1752,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1404,9 +1769,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1415,10 +1786,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1428,9 +1803,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1446,10 +1827,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1459,9 +1844,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1470,10 +1861,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1483,9 +1878,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1494,10 +1895,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1511,9 +1916,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, in interface{}) (model.UploadFile, error) { +func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, obj interface{}) (model.UploadFile, error) { var it model.UploadFile - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index f487ea28207..e38459d81e7 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -219,21 +219,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -292,11 +277,11 @@ scalar Banned // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -306,11 +291,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_search_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *model.SearchArgs - if tmp, ok := in["input"]; ok { + if tmp, ok := rawArgs["input"]; ok { arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx, tmp) if err != nil { return nil, err @@ -320,11 +305,11 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 external.ObjectID - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, tmp) if err != nil { return nil, err @@ -334,11 +319,11 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, in map[st return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -348,11 +333,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -370,9 +355,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) graphql.Marshaler { +func (ec *executionContext) _Address_id(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, @@ -381,10 +372,14 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -397,9 +392,15 @@ func (ec *executionContext) _Address_id(ctx context.Context, field graphql.Colle return ec.marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, field.Selections, res) } -func (ec *executionContext) _Address_location(ctx context.Context, field graphql.CollectedField, obj *model.Address) graphql.Marshaler { +func (ec *executionContext) _Address_location(ctx context.Context, field graphql.CollectedField, obj *model.Address) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Address", Field: field, @@ -408,10 +409,14 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Location, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -421,9 +426,15 @@ func (ec *executionContext) _Address_location(ctx context.Context, field graphql return ec.marshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, field.Selections, res) } -func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_user(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -439,10 +450,14 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(external.ObjectID)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -452,9 +467,15 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle return ec.marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -470,10 +491,14 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["input"].(*model.SearchArgs)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -486,9 +511,15 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return ec.marshalNUser2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -504,10 +535,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -517,9 +552,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -528,10 +569,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -541,9 +586,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -552,10 +603,14 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -568,9 +623,15 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, field.Selections, res) } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -579,10 +640,14 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -595,9 +660,15 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_created(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -606,10 +677,14 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -619,9 +694,15 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col return ec.marshalOTimestamp2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -630,10 +711,14 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsBanned, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -646,9 +731,15 @@ func (ec *executionContext) _User_isBanned(ctx context.Context, field graphql.Co return ec.marshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx, field.Selections, res) } -func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -657,10 +748,14 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().PrimitiveResolver(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -673,9 +768,15 @@ func (ec *executionContext) _User_primitiveResolver(ctx context.Context, field g return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _User_customResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_customResolver(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -684,10 +785,14 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().CustomResolver(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -700,9 +805,15 @@ func (ec *executionContext) _User_customResolver(ctx context.Context, field grap return ec.marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, field.Selections, res) } -func (ec *executionContext) _User_address(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_address(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -711,10 +822,14 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Address, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -724,9 +839,15 @@ func (ec *executionContext) _User_address(ctx context.Context, field graphql.Col return ec.marshalOAddress2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐAddress(ctx, field.Selections, res) } -func (ec *executionContext) _User_tier(ctx context.Context, field graphql.CollectedField, obj *model.User) graphql.Marshaler { +func (ec *executionContext) _User_tier(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -735,10 +856,14 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Tier, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -748,9 +873,15 @@ func (ec *executionContext) _User_tier(ctx context.Context, field graphql.Collec return ec.marshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -759,10 +890,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -775,9 +910,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -786,10 +927,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -799,9 +944,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -810,10 +961,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -826,9 +981,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -837,10 +998,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -853,9 +1018,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -864,10 +1035,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -880,9 +1055,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -891,10 +1072,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -904,9 +1089,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -915,10 +1106,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -931,9 +1126,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -942,10 +1143,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -955,9 +1160,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -966,10 +1177,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -982,9 +1197,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -993,10 +1214,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1006,9 +1231,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1017,10 +1248,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1033,9 +1268,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1044,10 +1285,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1060,9 +1305,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1071,10 +1322,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1087,9 +1342,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1098,10 +1359,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1111,9 +1376,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1122,10 +1393,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1138,9 +1413,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1149,10 +1430,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1162,9 +1447,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1173,10 +1464,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1189,9 +1484,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1200,10 +1501,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1213,9 +1518,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1224,10 +1535,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1240,9 +1555,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1251,10 +1572,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1267,9 +1592,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1278,10 +1609,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1291,9 +1626,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1302,10 +1643,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1315,9 +1660,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1326,10 +1677,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1342,9 +1697,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1353,10 +1714,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1369,9 +1734,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1380,10 +1751,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1393,9 +1768,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1404,10 +1785,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1417,9 +1802,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1435,10 +1826,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1448,9 +1843,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1459,10 +1860,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1472,9 +1877,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1483,10 +1894,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1496,9 +1911,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1514,10 +1935,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1527,9 +1952,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1538,10 +1969,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1551,9 +1986,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1562,10 +2003,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1579,9 +2024,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, in interface{}) (model.SearchArgs, error) { +func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, obj interface{}) (model.SearchArgs, error) { var it model.SearchArgs - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/selection/generated.go b/example/selection/generated.go index 8a8d7775703..bfd540e351f 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -177,21 +177,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -238,11 +223,11 @@ scalar Time // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -252,11 +237,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -266,11 +251,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -288,9 +273,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { +func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, @@ -299,10 +290,14 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Reaction, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -315,9 +310,15 @@ func (ec *executionContext) _Like_reaction(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { +func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, @@ -326,10 +327,14 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -342,9 +347,15 @@ func (ec *executionContext) _Like_sent(ctx context.Context, field graphql.Collec return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { +func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, @@ -353,10 +364,14 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -366,9 +381,15 @@ func (ec *executionContext) _Like_selection(ctx context.Context, field graphql.C return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) graphql.Marshaler { +func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.CollectedField, obj *Like) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Like", Field: field, @@ -377,10 +398,14 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -390,9 +415,15 @@ func (ec *executionContext) _Like_collected(ctx context.Context, field graphql.C return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { +func (ec *executionContext) _Post_message(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, @@ -401,10 +432,14 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Message, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -417,9 +452,15 @@ func (ec *executionContext) _Post_message(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { +func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, @@ -428,10 +469,14 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Sent, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -444,9 +489,15 @@ func (ec *executionContext) _Post_sent(ctx context.Context, field graphql.Collec return ec.marshalNTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { +func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, @@ -455,10 +506,14 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Selection, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -468,9 +523,15 @@ func (ec *executionContext) _Post_selection(ctx context.Context, field graphql.C return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) graphql.Marshaler { +func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.CollectedField, obj *Post) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Post", Field: field, @@ -479,10 +540,14 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Collected, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -492,9 +557,15 @@ func (ec *executionContext) _Post_collected(ctx context.Context, field graphql.C return ec.marshalOString2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_events(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -503,10 +574,14 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Events(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -516,9 +591,15 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col return ec.marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋselectionᚐEvent(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -534,10 +615,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -547,9 +632,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -558,10 +649,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -571,9 +666,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -582,10 +683,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -598,9 +703,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -609,10 +720,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -622,9 +737,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -633,10 +754,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -649,9 +774,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -660,10 +791,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -676,9 +811,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -687,10 +828,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -703,9 +848,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -714,10 +865,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -727,9 +882,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -738,10 +899,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -754,9 +919,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -765,10 +936,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -778,9 +953,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -789,10 +970,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -805,9 +990,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -816,10 +1007,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -829,9 +1024,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -840,10 +1041,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -856,9 +1061,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -867,10 +1078,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -883,9 +1098,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -894,10 +1115,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -910,9 +1135,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -921,10 +1152,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -934,9 +1169,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -945,10 +1186,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -961,9 +1206,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -972,10 +1223,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -985,9 +1240,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -996,10 +1257,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1012,9 +1277,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1023,10 +1294,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1036,9 +1311,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1047,10 +1328,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1063,9 +1348,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1074,10 +1365,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1090,9 +1385,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1101,10 +1402,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1114,9 +1419,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1125,10 +1436,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1138,9 +1453,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1149,10 +1470,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1165,9 +1490,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1176,10 +1507,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1192,9 +1527,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1203,10 +1544,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1216,9 +1561,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1227,10 +1578,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1240,9 +1595,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1258,10 +1619,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1271,9 +1636,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1282,10 +1653,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1295,9 +1670,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1306,10 +1687,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1319,9 +1704,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1337,10 +1728,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1350,9 +1745,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1361,10 +1762,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1374,9 +1779,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1385,10 +1796,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index c26611204fe..2c6c8704973 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -533,21 +533,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -701,11 +686,11 @@ scalar Time // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := in["first"]; ok { + if tmp, ok := rawArgs["first"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -713,7 +698,7 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte } args["first"] = arg0 var arg1 *string - if tmp, ok := in["after"]; ok { + if tmp, ok := rawArgs["after"]; ok { arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err @@ -723,11 +708,11 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := in["first"]; ok { + if tmp, ok := rawArgs["first"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -735,7 +720,7 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte } args["first"] = arg0 var arg1 *string - if tmp, ok := in["after"]; ok { + if tmp, ok := rawArgs["after"]; ok { arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err @@ -745,11 +730,11 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte return args, nil } -func (ec *executionContext) field_Human_height_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Human_height_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.LengthUnit - if tmp, ok := in["unit"]; ok { + if tmp, ok := rawArgs["unit"]; ok { arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) if err != nil { return nil, err @@ -759,11 +744,11 @@ func (ec *executionContext) field_Human_height_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.Episode - if tmp, ok := in["episode"]; ok { + if tmp, ok := rawArgs["episode"]; ok { arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err @@ -771,7 +756,7 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context } args["episode"] = arg0 var arg1 models.Review - if tmp, ok := in["review"]; ok { + if tmp, ok := rawArgs["review"]; ok { arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, tmp) if err != nil { return nil, err @@ -781,11 +766,11 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -795,11 +780,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_character_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_character_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -809,11 +794,11 @@ func (ec *executionContext) field_Query_character_args(ctx context.Context, in m return args, nil } -func (ec *executionContext) field_Query_droid_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_droid_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -823,11 +808,11 @@ func (ec *executionContext) field_Query_droid_args(ctx context.Context, in map[s return args, nil } -func (ec *executionContext) field_Query_hero_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_hero_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *models.Episode - if tmp, ok := in["episode"]; ok { + if tmp, ok := rawArgs["episode"]; ok { arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err @@ -837,11 +822,11 @@ func (ec *executionContext) field_Query_hero_args(ctx context.Context, in map[st return args, nil } -func (ec *executionContext) field_Query_human_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_human_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -851,11 +836,11 @@ func (ec *executionContext) field_Query_human_args(ctx context.Context, in map[s return args, nil } -func (ec *executionContext) field_Query_reviews_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.Episode - if tmp, ok := in["episode"]; ok { + if tmp, ok := rawArgs["episode"]; ok { arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err @@ -863,7 +848,7 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, in map } args["episode"] = arg0 var arg1 *time.Time - if tmp, ok := in["since"]; ok { + if tmp, ok := rawArgs["since"]; ok { arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) if err != nil { return nil, err @@ -873,11 +858,11 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, in map return args, nil } -func (ec *executionContext) field_Query_search_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["text"]; ok { + if tmp, ok := rawArgs["text"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -887,11 +872,11 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_starship_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_starship_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -901,11 +886,11 @@ func (ec *executionContext) field_Query_starship_args(ctx context.Context, in ma return args, nil } -func (ec *executionContext) field_Starship_length_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Starship_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *models.LengthUnit - if tmp, ok := in["unit"]; ok { + if tmp, ok := rawArgs["unit"]; ok { arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) if err != nil { return nil, err @@ -915,11 +900,11 @@ func (ec *executionContext) field_Starship_length_args(ctx context.Context, in m return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -929,11 +914,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -951,9 +936,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { +func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, @@ -962,10 +953,14 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -978,9 +973,15 @@ func (ec *executionContext) _Droid_id(ctx context.Context, field graphql.Collect return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { +func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, @@ -989,10 +990,14 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1005,9 +1010,15 @@ func (ec *executionContext) _Droid_name(ctx context.Context, field graphql.Colle return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { +func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, @@ -1016,10 +1027,14 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().Friends(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1029,9 +1044,15 @@ func (ec *executionContext) _Droid_friends(ctx context.Context, field graphql.Co return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } -func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { +func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, @@ -1047,10 +1068,14 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Droid().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1063,9 +1088,15 @@ func (ec *executionContext) _Droid_friendsConnection(ctx context.Context, field return ec.marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx, field.Selections, res) } -func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { +func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, @@ -1074,10 +1105,14 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1090,9 +1125,15 @@ func (ec *executionContext) _Droid_appearsIn(ctx context.Context, field graphql. return ec.marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, field.Selections, res) } -func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *models.Droid) graphql.Marshaler { +func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field graphql.CollectedField, obj *models.Droid) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Droid", Field: field, @@ -1101,10 +1142,14 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PrimaryFunction, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1114,9 +1159,15 @@ func (ec *executionContext) _Droid_primaryFunction(ctx context.Context, field gr return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) graphql.Marshaler { +func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, @@ -1125,10 +1176,14 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.TotalCount(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1141,9 +1196,15 @@ func (ec *executionContext) _FriendsConnection_totalCount(ctx context.Context, f return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) graphql.Marshaler { +func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, @@ -1152,10 +1213,14 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Edges(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1165,9 +1230,15 @@ func (ec *executionContext) _FriendsConnection_edges(ctx context.Context, field return ec.marshalOFriendsEdge2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsEdge(ctx, field.Selections, res) } -func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) graphql.Marshaler { +func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, @@ -1176,10 +1247,14 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.FriendsConnection().Friends(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1189,9 +1264,15 @@ func (ec *executionContext) _FriendsConnection_friends(ctx context.Context, fiel return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } -func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) graphql.Marshaler { +func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *models.FriendsConnection) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "FriendsConnection", Field: field, @@ -1200,10 +1281,14 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PageInfo(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1216,9 +1301,15 @@ func (ec *executionContext) _FriendsConnection_pageInfo(ctx context.Context, fie return ec.marshalNPageInfo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐPageInfo(ctx, field.Selections, res) } -func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) graphql.Marshaler { +func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "FriendsEdge", Field: field, @@ -1227,10 +1318,14 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Cursor, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1243,9 +1338,15 @@ func (ec *executionContext) _FriendsEdge_cursor(ctx context.Context, field graph return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) graphql.Marshaler { +func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql.CollectedField, obj *models.FriendsEdge) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "FriendsEdge", Field: field, @@ -1254,10 +1355,14 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Node, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1267,9 +1372,15 @@ func (ec *executionContext) _FriendsEdge_node(ctx context.Context, field graphql return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } -func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_id(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1278,10 +1389,14 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1294,9 +1409,15 @@ func (ec *executionContext) _Human_id(ctx context.Context, field graphql.Collect return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_name(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1305,10 +1426,14 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1321,9 +1446,15 @@ func (ec *executionContext) _Human_name(ctx context.Context, field graphql.Colle return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_height(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1339,10 +1470,14 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Height(args["unit"].(models.LengthUnit)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1355,9 +1490,15 @@ func (ec *executionContext) _Human_height(ctx context.Context, field graphql.Col return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1366,10 +1507,14 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Mass, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1379,9 +1524,15 @@ func (ec *executionContext) _Human_mass(ctx context.Context, field graphql.Colle return ec.marshalOFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1390,10 +1541,14 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Friends(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1403,9 +1558,15 @@ func (ec *executionContext) _Human_friends(ctx context.Context, field graphql.Co return ec.marshalOCharacter2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } -func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1421,10 +1582,14 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().FriendsConnection(rctx, obj, args["first"].(*int), args["after"].(*string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1437,9 +1602,15 @@ func (ec *executionContext) _Human_friendsConnection(ctx context.Context, field return ec.marshalNFriendsConnection2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐFriendsConnection(ctx, field.Selections, res) } -func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1448,10 +1619,14 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.AppearsIn, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1464,9 +1639,15 @@ func (ec *executionContext) _Human_appearsIn(ctx context.Context, field graphql. return ec.marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, field.Selections, res) } -func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *models.Human) graphql.Marshaler { +func (ec *executionContext) _Human_starships(ctx context.Context, field graphql.CollectedField, obj *models.Human) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Human", Field: field, @@ -1475,10 +1656,14 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Human().Starships(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1488,9 +1673,15 @@ func (ec *executionContext) _Human_starships(ctx context.Context, field graphql. return ec.marshalOStarship2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx, field.Selections, res) } -func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Mutation_createReview(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Mutation", Field: field, @@ -1506,10 +1697,14 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Mutation().CreateReview(rctx, args["episode"].(models.Episode), args["review"].(models.Review)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1519,9 +1714,15 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr return ec.marshalOReview2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { +func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "PageInfo", Field: field, @@ -1530,10 +1731,14 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.StartCursor, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1546,9 +1751,15 @@ func (ec *executionContext) _PageInfo_startCursor(ctx context.Context, field gra return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { +func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "PageInfo", Field: field, @@ -1557,10 +1768,14 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EndCursor, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1573,9 +1788,15 @@ func (ec *executionContext) _PageInfo_endCursor(ctx context.Context, field graph return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) graphql.Marshaler { +func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field graphql.CollectedField, obj *models.PageInfo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "PageInfo", Field: field, @@ -1584,10 +1805,14 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.HasNextPage, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1600,9 +1825,15 @@ func (ec *executionContext) _PageInfo_hasNextPage(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1618,10 +1849,14 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Hero(rctx, args["episode"].(*models.Episode)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1631,9 +1866,15 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } -func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1649,10 +1890,14 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Reviews(rctx, args["episode"].(models.Episode), args["since"].(*time.Time)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1665,9 +1910,15 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co return ec.marshalNReview2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, field.Selections, res) } -func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_search(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1683,10 +1934,14 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Search(rctx, args["text"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1699,11 +1954,17 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col return ec.marshalNSearchResult2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐSearchResult(ctx, field.Selections, res) } -func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_character(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() - rctx := &graphql.ResolverContext{ - Object: "Query", + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() + rctx := &graphql.ResolverContext{ + Object: "Query", Field: field, Args: nil, IsMethod: true, @@ -1717,10 +1978,14 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Character(rctx, args["id"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1730,9 +1995,15 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. return ec.marshalOCharacter2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐCharacter(ctx, field.Selections, res) } -func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1748,10 +2019,14 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Droid(rctx, args["id"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1761,9 +2036,15 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll return ec.marshalODroid2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐDroid(ctx, field.Selections, res) } -func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_human(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1779,10 +2060,14 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Human(rctx, args["id"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1792,9 +2077,15 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll return ec.marshalOHuman2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐHuman(ctx, field.Selections, res) } -func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1810,10 +2101,14 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Starship(rctx, args["id"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1823,9 +2118,15 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C return ec.marshalOStarship2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐStarship(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1841,10 +2142,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1854,9 +2159,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -1865,10 +2176,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1878,9 +2193,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *models.Review) graphql.Marshaler { +func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Review", Field: field, @@ -1889,10 +2210,14 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Stars, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1905,9 +2230,15 @@ func (ec *executionContext) _Review_stars(ctx context.Context, field graphql.Col return ec.marshalNInt2int(ctx, field.Selections, res) } -func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *models.Review) graphql.Marshaler { +func (ec *executionContext) _Review_commentary(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Review", Field: field, @@ -1916,10 +2247,14 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Commentary, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1929,9 +2264,15 @@ func (ec *executionContext) _Review_commentary(ctx context.Context, field graphq return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *models.Review) graphql.Marshaler { +func (ec *executionContext) _Review_time(ctx context.Context, field graphql.CollectedField, obj *models.Review) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Review", Field: field, @@ -1940,10 +2281,14 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Time, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1953,9 +2298,15 @@ func (ec *executionContext) _Review_time(ctx context.Context, field graphql.Coll return ec.marshalOTime2timeᚐTime(ctx, field.Selections, res) } -func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *models.Starship) graphql.Marshaler { +func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, @@ -1964,10 +2315,14 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1980,9 +2335,15 @@ func (ec *executionContext) _Starship_id(ctx context.Context, field graphql.Coll return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *models.Starship) graphql.Marshaler { +func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, @@ -1991,10 +2352,14 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2007,9 +2372,15 @@ func (ec *executionContext) _Starship_name(ctx context.Context, field graphql.Co return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *models.Starship) graphql.Marshaler { +func (ec *executionContext) _Starship_length(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, @@ -2025,10 +2396,14 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Starship().Length(rctx, obj, args["unit"].(*models.LengthUnit)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2041,9 +2416,15 @@ func (ec *executionContext) _Starship_length(ctx context.Context, field graphql. return ec.marshalNFloat2float64(ctx, field.Selections, res) } -func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *models.Starship) graphql.Marshaler { +func (ec *executionContext) _Starship_history(ctx context.Context, field graphql.CollectedField, obj *models.Starship) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Starship", Field: field, @@ -2052,10 +2433,14 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.History, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2068,9 +2453,15 @@ func (ec *executionContext) _Starship_history(ctx context.Context, field graphql return ec.marshalNInt2ᚕᚕint(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -2079,10 +2470,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2095,9 +2490,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -2106,10 +2507,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2119,9 +2524,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -2130,10 +2541,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2146,9 +2561,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -2157,10 +2578,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2173,9 +2598,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -2184,10 +2615,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2200,9 +2635,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -2211,10 +2652,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2224,9 +2669,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -2235,10 +2686,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2251,9 +2706,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -2262,10 +2723,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2275,9 +2740,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -2286,10 +2757,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2302,9 +2777,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -2313,10 +2794,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2326,9 +2811,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -2337,10 +2828,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2353,9 +2848,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -2364,10 +2865,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2380,9 +2885,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -2391,10 +2902,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2407,9 +2922,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -2418,10 +2939,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2431,9 +2956,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -2442,10 +2973,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2458,9 +2993,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -2469,10 +3010,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2482,9 +3027,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -2493,10 +3044,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2509,9 +3064,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -2520,10 +3081,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2533,9 +3098,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -2544,10 +3115,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2560,9 +3135,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -2571,10 +3152,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2587,9 +3172,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -2598,10 +3189,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2611,9 +3206,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -2622,10 +3223,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2635,9 +3240,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -2646,10 +3257,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2662,9 +3277,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2673,10 +3294,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2689,9 +3314,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2700,10 +3331,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2713,9 +3348,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2724,10 +3365,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2737,9 +3382,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2755,10 +3406,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2768,9 +3423,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2779,10 +3440,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2792,9 +3457,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2803,10 +3474,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2816,9 +3491,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2834,10 +3515,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2847,9 +3532,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2858,10 +3549,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2871,9 +3566,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -2882,10 +3583,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -2899,9 +3604,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, in interface{}) (models.Review, error) { +func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, obj interface{}) (models.Review, error) { var it models.Review - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/todo/generated.go b/example/todo/generated.go index 9f4698f10bc..9037c667161 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -6,6 +6,7 @@ import ( "bytes" "context" "errors" + "fmt" "strconv" "sync" "sync/atomic" @@ -210,52 +211,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Definition.Directives { - switch d.Name { - case "hasRole": - if ec.directives.HasRole != nil { - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_hasRole_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.HasRole(ctx, obj, n, args["role"].(Role)) - } - } - case "user": - if ec.directives.User != nil { - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_user_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.User(ctx, obj, n, args["id"].(int)) - } - } - } - } - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -318,11 +273,11 @@ enum Role { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_hasRole_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 Role - if tmp, ok := in["role"]; ok { + if tmp, ok := rawArgs["role"]; ok { arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx, tmp) if err != nil { return nil, err @@ -332,11 +287,11 @@ func (ec *executionContext) dir_hasRole_args(ctx context.Context, in map[string] return args, nil } -func (ec *executionContext) dir_user_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err @@ -346,11 +301,11 @@ func (ec *executionContext) dir_user_args(ctx context.Context, in map[string]int return args, nil } -func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 TodoInput - if tmp, ok := in["todo"]; ok { + if tmp, ok := rawArgs["todo"]; ok { arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(ctx, tmp) if err != nil { return nil, err @@ -360,11 +315,11 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context return args, nil } -func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err @@ -372,7 +327,7 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context } args["id"] = arg0 var arg1 map[string]interface{} - if tmp, ok := in["changes"]; ok { + if tmp, ok := rawArgs["changes"]; ok { arg1, err = ec.unmarshalNMap2map(ctx, tmp) if err != nil { return nil, err @@ -382,11 +337,11 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context return args, nil } -func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -396,11 +351,11 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, in ma return args, nil } -func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err @@ -410,11 +365,11 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -424,11 +379,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -506,9 +461,15 @@ func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.Op // region **************************** field.gotpl ***************************** -func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyMutation", Field: field, @@ -524,10 +485,14 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -540,9 +505,15 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyMutation", Field: field, @@ -558,10 +529,14 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{})) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -571,9 +546,15 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -589,10 +570,14 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -602,9 +587,15 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -613,10 +604,14 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().LastTodo(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -626,9 +621,15 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -637,10 +638,14 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -653,9 +658,15 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -671,10 +682,14 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -684,9 +699,15 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -695,10 +716,14 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -708,9 +733,15 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -719,10 +750,14 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -735,9 +770,15 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2int(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -746,10 +787,14 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -762,9 +807,15 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -773,10 +824,31 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Done, nil + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Done, nil + } + directive1 := func(ctx context.Context) (interface{}, error) { + role, err := ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx, "OWNER") + if err != nil { + return nil, err + } + return ec.directives.HasRole(ctx, obj, directive0, role) + } + tmp, err := directive1(rctx) + if err != nil { + return nil, err + } + if data, ok := tmp.(bool); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be bool`, tmp) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -789,9 +861,15 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -800,10 +878,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -816,9 +898,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -827,10 +915,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -840,9 +932,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -851,10 +949,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -867,9 +969,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -878,10 +986,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -894,9 +1006,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -905,10 +1023,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -921,9 +1043,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -932,10 +1060,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -945,9 +1077,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -956,10 +1094,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -972,9 +1114,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -983,10 +1131,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -996,9 +1148,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1007,10 +1165,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1023,9 +1185,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1034,10 +1202,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1047,9 +1219,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1058,10 +1236,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1074,9 +1256,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1085,10 +1273,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1101,9 +1293,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1112,10 +1310,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1128,9 +1330,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1139,10 +1347,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1152,9 +1364,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1163,10 +1381,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1179,9 +1401,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1190,10 +1418,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1203,9 +1435,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1214,10 +1452,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1230,9 +1472,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1241,10 +1489,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1254,9 +1506,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1265,10 +1523,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1281,9 +1543,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1292,10 +1560,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1308,9 +1580,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1319,10 +1597,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1332,9 +1614,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1343,10 +1631,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1356,9 +1648,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1367,10 +1665,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1383,9 +1685,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1394,10 +1702,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1410,9 +1722,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1421,10 +1739,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1434,9 +1756,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1445,10 +1773,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1458,9 +1790,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1476,10 +1814,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1489,9 +1831,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1500,10 +1848,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1513,9 +1865,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1524,10 +1882,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1537,9 +1899,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1555,10 +1923,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1568,9 +1940,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1579,10 +1957,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1592,9 +1974,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1603,10 +1991,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1620,9 +2012,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, in interface{}) (TodoInput, error) { +func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj interface{}) (TodoInput, error) { var it TodoInput - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 5b9576ad27e..1843b462b44 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -202,75 +202,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Definition.Directives { - switch d.Name { - case "enumLogging": - if ec.directives.EnumLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.EnumLogging(ctx, obj, n) - } - } - case "fieldLogging": - if ec.directives.FieldLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.FieldLogging(ctx, obj, n) - } - } - case "inputLogging": - if ec.directives.InputLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.InputLogging(ctx, obj, n) - } - } - case "interfaceLogging": - if ec.directives.InterfaceLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.InterfaceLogging(ctx, obj, n) - } - } - case "objectLogging": - if ec.directives.ObjectLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.ObjectLogging(ctx, obj, n) - } - } - case "scalarLogging": - if ec.directives.ScalarLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.ScalarLogging(ctx, obj, n) - } - } - case "unionLogging": - if ec.directives.UnionLogging != nil { - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.UnionLogging(ctx, obj, n) - } - } - } - } - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -367,11 +298,11 @@ extend union Data @unionLogging // region ***************************** args.gotpl ***************************** -func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 TodoInput - if tmp, ok := in["todo"]; ok { + if tmp, ok := rawArgs["todo"]; ok { arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx, tmp) if err != nil { return nil, err @@ -381,11 +312,11 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context return args, nil } -func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -395,11 +326,11 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, in ma return args, nil } -func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["id"]; ok { + if tmp, ok := rawArgs["id"]; ok { arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err @@ -409,11 +340,11 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -423,11 +354,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -445,9 +376,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyMutation", Field: field, @@ -463,10 +400,14 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -479,9 +420,15 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr return ec.marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -490,10 +437,14 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -506,9 +457,15 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co return ec.marshalNTodo2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -524,10 +481,14 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -537,9 +498,15 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col return ec.marshalOTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodo(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -555,10 +522,14 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -568,9 +539,15 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "MyQuery", Field: field, @@ -579,10 +556,14 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -592,9 +573,15 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -603,10 +590,14 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -619,9 +610,15 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -630,10 +627,14 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -646,9 +647,15 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -657,10 +664,14 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.State, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -673,9 +684,15 @@ func (ec *executionContext) _Todo_state(ctx context.Context, field graphql.Colle return ec.marshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx, field.Selections, res) } -func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.CollectedField, obj *Todo) graphql.Marshaler { +func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.CollectedField, obj *Todo) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Todo", Field: field, @@ -684,10 +701,27 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Verified, nil + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + directive0 := func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return obj.Verified, nil + } + directive1 := func(ctx context.Context) (interface{}, error) { + return ec.directives.FieldLogging(ctx, obj, directive0) + } + tmp, err := directive1(rctx) + if err != nil { + return nil, err + } + if data, ok := tmp.(bool); ok { + return data, nil + } + return nil, fmt.Errorf(`unexpected type %T from directive, should be bool`, tmp) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -700,9 +734,15 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -711,10 +751,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -727,9 +771,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -738,10 +788,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -751,9 +805,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -762,10 +822,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -778,9 +842,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -789,10 +859,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -805,9 +879,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -816,10 +896,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -832,9 +916,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -843,10 +933,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -856,9 +950,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -867,10 +967,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -883,9 +987,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -894,10 +1004,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -907,9 +1021,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -918,10 +1038,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -934,9 +1058,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -945,10 +1075,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -958,9 +1092,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -969,10 +1109,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -985,9 +1129,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -996,10 +1146,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1012,9 +1166,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1023,10 +1183,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1039,9 +1203,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1050,10 +1220,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1063,9 +1237,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1074,10 +1254,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1090,9 +1274,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1101,10 +1291,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1114,9 +1308,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1125,10 +1325,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1141,9 +1345,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1152,10 +1362,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1165,9 +1379,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1176,10 +1396,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1192,9 +1416,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1203,10 +1433,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1219,9 +1453,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1230,10 +1470,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1243,9 +1487,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1254,10 +1504,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1267,9 +1521,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1278,10 +1538,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1294,9 +1558,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1305,10 +1575,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1321,9 +1595,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1332,10 +1612,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1345,9 +1629,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1356,10 +1646,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1369,9 +1663,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1387,10 +1687,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1400,9 +1704,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1411,10 +1721,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1424,9 +1738,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1435,10 +1755,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1448,9 +1772,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1466,10 +1796,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1479,9 +1813,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1490,10 +1830,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1503,9 +1847,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1514,10 +1864,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1531,9 +1885,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, in interface{}) (TodoInput, error) { +func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj interface{}) (TodoInput, error) { var it TodoInput - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) for k, v := range asMap { switch k { diff --git a/integration/generated.go b/integration/generated.go index 64107e2ca34..20c41fe8ccf 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -236,39 +236,6 @@ type executionContext struct { *executableSchema } -func (ec *executionContext) FieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) (ret interface{}) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - rctx := graphql.GetResolverContext(ctx) - for _, d := range rctx.Field.Definition.Directives { - switch d.Name { - case "magic": - if ec.directives.Magic != nil { - rawArgs := d.ArgumentMap(ec.Variables) - args, err := ec.dir_magic_args(ctx, rawArgs) - if err != nil { - ec.Error(ctx, err) - return nil - } - n := next - next = func(ctx context.Context) (interface{}, error) { - return ec.directives.Magic(ctx, obj, n, args["kind"].(*int)) - } - } - } - } - res, err := ec.ResolverMiddleware(ctx, next) - if err != nil { - ec.Error(ctx, err) - return nil - } - return res -} - func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { if ec.DisableIntrospection { return nil, errors.New("introspection disabled") @@ -342,11 +309,11 @@ enum ErrorType { // region ***************************** args.gotpl ***************************** -func (ec *executionContext) dir_magic_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) dir_magic_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *int - if tmp, ok := in["kind"]; ok { + if tmp, ok := rawArgs["kind"]; ok { arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err @@ -356,11 +323,11 @@ func (ec *executionContext) dir_magic_args(ctx context.Context, in map[string]in return args, nil } -func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 string - if tmp, ok := in["name"]; ok { + if tmp, ok := rawArgs["name"]; ok { arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err @@ -370,11 +337,11 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, in map[ return args, nil } -func (ec *executionContext) field_Query_complexity_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_complexity_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 int - if tmp, ok := in["value"]; ok { + if tmp, ok := rawArgs["value"]; ok { arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err @@ -384,11 +351,11 @@ func (ec *executionContext) field_Query_complexity_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field_Query_date_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_date_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 models.DateFilter - if tmp, ok := in["filter"]; ok { + if tmp, ok := rawArgs["filter"]; ok { arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(ctx, tmp) if err != nil { return nil, err @@ -398,11 +365,11 @@ func (ec *executionContext) field_Query_date_args(ctx context.Context, in map[st return args, nil } -func (ec *executionContext) field_Query_error_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_error_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 *models.ErrorType - if tmp, ok := in["type"]; ok { + if tmp, ok := rawArgs["type"]; ok { arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx, tmp) if err != nil { return nil, err @@ -412,11 +379,11 @@ func (ec *executionContext) field_Query_error_args(ctx context.Context, in map[s return args, nil } -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -426,11 +393,11 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, in return args, nil } -func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} var arg0 bool - if tmp, ok := in["includeDeprecated"]; ok { + if tmp, ok := rawArgs["includeDeprecated"]; ok { arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err @@ -448,9 +415,15 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, in map // region **************************** field.gotpl ***************************** -func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) graphql.Marshaler { +func (ec *executionContext) _Element_child(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Element", Field: field, @@ -459,10 +432,14 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Child(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -475,9 +452,15 @@ func (ec *executionContext) _Element_child(ctx context.Context, field graphql.Co return ec.marshalNElement2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx, field.Selections, res) } -func (ec *executionContext) _Element_error(ctx context.Context, field graphql.CollectedField, obj *models.Element) graphql.Marshaler { +func (ec *executionContext) _Element_error(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Element", Field: field, @@ -486,10 +469,14 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Error(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -502,9 +489,15 @@ func (ec *executionContext) _Element_error(ctx context.Context, field graphql.Co return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Element_mismatched(ctx context.Context, field graphql.CollectedField, obj *models.Element) graphql.Marshaler { +func (ec *executionContext) _Element_mismatched(ctx context.Context, field graphql.CollectedField, obj *models.Element) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Element", Field: field, @@ -513,10 +506,14 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Element().Mismatched(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -526,9 +523,15 @@ func (ec *executionContext) _Element_mismatched(ctx context.Context, field graph return ec.marshalOBoolean2ᚕbool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_path(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_path(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -537,10 +540,14 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Path(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -550,9 +557,15 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle return ec.marshalOElement2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx, field.Selections, res) } -func (ec *executionContext) _Query_date(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_date(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -568,10 +581,14 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Date(rctx, args["filter"].(models.DateFilter)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -584,9 +601,15 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -595,10 +618,14 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Viewer(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -608,9 +635,15 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col return ec.marshalOViewer2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐViewer(ctx, field.Selections, res) } -func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -619,10 +652,14 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().JSONEncoding(rctx) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -635,9 +672,15 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _Query_error(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_error(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -653,10 +696,14 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Error(rctx, args["type"].(*models.ErrorType)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -669,9 +716,15 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -687,10 +740,14 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Complexity(rctx, args["value"].(int)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -703,9 +760,15 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -721,10 +784,14 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -734,9 +801,15 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) graphql.Marshaler { +func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Query", Field: field, @@ -745,10 +818,14 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -758,9 +835,15 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) } -func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) graphql.Marshaler { +func (ec *executionContext) _User_name(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -769,10 +852,14 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -785,9 +872,15 @@ func (ec *executionContext) _User_name(ctx context.Context, field graphql.Collec return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) _User_likes(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) graphql.Marshaler { +func (ec *executionContext) _User_likes(ctx context.Context, field graphql.CollectedField, obj *remote_api.User) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "User", Field: field, @@ -796,10 +889,14 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Likes(rctx, obj) }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -812,9 +909,15 @@ func (ec *executionContext) _User_likes(ctx context.Context, field graphql.Colle return ec.marshalNString2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.CollectedField, obj *models.Viewer) graphql.Marshaler { +func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.CollectedField, obj *models.Viewer) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "Viewer", Field: field, @@ -823,10 +926,14 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.User, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -836,9 +943,15 @@ func (ec *executionContext) _Viewer_user(ctx context.Context, field graphql.Coll return ec.marshalOUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋremote_apiᚐUser(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -847,10 +960,14 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -863,9 +980,15 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -874,10 +997,14 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -887,9 +1014,15 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -898,10 +1031,14 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -914,9 +1051,15 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr return ec.marshalN__DirectiveLocation2ᚕstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) graphql.Marshaler { +func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Directive", Field: field, @@ -925,10 +1068,14 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -941,9 +1088,15 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -952,10 +1105,14 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -968,9 +1125,15 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -979,10 +1142,14 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -992,9 +1159,15 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -1003,10 +1176,14 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1019,9 +1196,15 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) graphql.Marshaler { +func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__EnumValue", Field: field, @@ -1030,10 +1213,14 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1043,9 +1230,15 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1054,10 +1247,14 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1070,9 +1267,15 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1081,10 +1284,14 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1094,9 +1301,15 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1105,10 +1318,14 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1121,9 +1338,15 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1132,10 +1355,14 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1148,9 +1375,15 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1159,10 +1392,14 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1175,9 +1412,15 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) graphql.Marshaler { +func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Field", Field: field, @@ -1186,10 +1429,14 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1199,9 +1446,15 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1210,10 +1463,14 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1226,9 +1483,15 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1237,10 +1500,14 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1250,9 +1517,15 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1261,10 +1534,14 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1277,9 +1554,15 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) graphql.Marshaler { +func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__InputValue", Field: field, @@ -1288,10 +1571,14 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1301,9 +1588,15 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1312,10 +1605,14 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1328,9 +1625,15 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1339,10 +1642,14 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1355,9 +1662,15 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1366,10 +1679,14 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1379,9 +1696,15 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1390,10 +1713,14 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1403,9 +1730,15 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) graphql.Marshaler { +func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Schema", Field: field, @@ -1414,10 +1747,14 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1430,9 +1767,15 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1441,10 +1784,14 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1457,9 +1804,15 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll return ec.marshalN__TypeKind2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1468,10 +1821,14 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1481,9 +1838,15 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1492,10 +1855,14 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1505,9 +1872,15 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph return ec.marshalOString2string(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1523,10 +1896,14 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1536,9 +1913,15 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1547,10 +1930,14 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1560,9 +1947,15 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1571,10 +1964,14 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1584,9 +1981,15 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1602,10 +2005,14 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1615,9 +2022,15 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1626,10 +2039,14 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1639,9 +2056,15 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, field.Selections, res) } -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) graphql.Marshaler { +func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { ctx = ec.Tracer.StartFieldExecution(ctx, field) - defer func() { ec.Tracer.EndFieldExecution(ctx) }() + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() rctx := &graphql.ResolverContext{ Object: "__Type", Field: field, @@ -1650,10 +2073,14 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp := ec.FieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } if resTmp == nil { return graphql.Null } @@ -1667,9 +2094,9 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co // region **************************** input.gotpl ***************************** -func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, in interface{}) (models.DateFilter, error) { +func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, obj interface{}) (models.DateFilter, error) { var it models.DateFilter - var asMap = in.(map[string]interface{}) + var asMap = obj.(map[string]interface{}) if _, present := asMap["timezone"]; !present { asMap["timezone"] = "UTC" From a58ecfe9be6b8aa9201a3221e2838ea7cf5b2f9f Mon Sep 17 00:00:00 2001 From: asamusev Date: Tue, 25 Jun 2019 09:49:40 +0300 Subject: [PATCH 28/30] add example and test field directive --- codegen/testserver/directive_test.go | 33 +- codegen/testserver/generated.go | 1085 +++++++++----------------- codegen/testserver/resolver.go | 3 + codegen/testserver/schema.graphql | 3 + codegen/testserver/stub.go | 4 + example/todo/generated.go | 321 +++----- example/todo/schema.graphql | 2 +- example/todo/todo_test.go | 27 +- 8 files changed, 566 insertions(+), 912 deletions(-) diff --git a/codegen/testserver/directive_test.go b/codegen/testserver/directive_test.go index 3d6badd0804..b3e73adf31f 100644 --- a/codegen/testserver/directive_test.go +++ b/codegen/testserver/directive_test.go @@ -39,6 +39,14 @@ func TestDirectives(t *testing.T) { return &s, nil } + resolvers.QueryResolver.DirectiveField = func(ctx context.Context) (*string, error) { + if s, ok := ctx.Value("request_id").(*string); ok { + return s, nil + } + + return nil, nil + } + srv := httptest.NewServer( handler.GraphQL( NewExecutableSchema(Config{ @@ -46,7 +54,7 @@ func TestDirectives(t *testing.T) { Directives: DirectiveRoot{ Length: func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int, message *string) (interface{}, error) { e := func(msg string) error { - if message == nil{ + if message == nil { return fmt.Errorf(msg) } return fmt.Errorf(*message) @@ -104,6 +112,9 @@ func TestDirectives(t *testing.T) { Custom: func(ctx context.Context, obj interface{}, next graphql.Resolver) (interface{}, error) { return next(ctx) }, + Logged: func(ctx context.Context, obj interface{}, next graphql.Resolver, id string) (interface{}, error) { + return next(context.WithValue(ctx, "request_id", &id)) + }, }, }), handler.ResolverMiddleware(func(ctx context.Context, next graphql.Resolver) (res interface{}, err error) { @@ -169,6 +180,26 @@ func TestDirectives(t *testing.T) { require.Equal(t, "Ok", *resp.DirectiveArg) }) }) + t.Run("field directives", func(t *testing.T) { + t.Run("add field directive", func(t *testing.T) { + var resp struct { + DirectiveField string + } + + c.MustPost(`query { directiveField@logged(id:"testes_id") }`, &resp) + + require.Equal(t, resp.DirectiveField, `testes_id`) + }) + t.Run("without field directive", func(t *testing.T) { + var resp struct { + DirectiveField *string + } + + c.MustPost(`query { directiveField }`, &resp) + + require.Nil(t, resp.DirectiveField) + }) + }) t.Run("input field directives", func(t *testing.T) { t.Run("when function errors on directives", func(t *testing.T) { var resp struct { diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index 4969e4bfe7f..aac80a6b14e 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -56,6 +56,8 @@ type DirectiveRoot struct { Length func(ctx context.Context, obj interface{}, next graphql.Resolver, min int, max *int, message *string) (res interface{}, err error) + Logged func(ctx context.Context, obj interface{}, next graphql.Resolver, id string) (res interface{}, err error) + Range func(ctx context.Context, obj interface{}, next graphql.Resolver, min *int, max *int) (res interface{}, err error) } @@ -193,6 +195,7 @@ type ComplexityRoot struct { DefaultScalar func(childComplexity int, arg string) int DeprecatedField func(childComplexity int) int DirectiveArg func(childComplexity int, arg string) int + DirectiveField func(childComplexity int) int DirectiveInput func(childComplexity int, arg InputDirectives) int DirectiveInputNullable func(childComplexity int, arg *InputDirectives) int DirectiveInputType func(childComplexity int, arg InnerInput) int @@ -323,6 +326,7 @@ type QueryResolver interface { DirectiveInputNullable(ctx context.Context, arg *InputDirectives) (*string, error) DirectiveInput(ctx context.Context, arg InputDirectives) (*string, error) DirectiveInputType(ctx context.Context, arg InnerInput) (*string, error) + DirectiveField(ctx context.Context) (*string, error) InputSlice(ctx context.Context, arg []string) (bool, error) ShapeUnion(ctx context.Context) (ShapeUnion, error) Autobind(ctx context.Context) (*Autobind, error) @@ -765,6 +769,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.DirectiveArg(childComplexity, args["arg"].(string)), true + case "Query.directiveField": + if e.complexity.Query.DirectiveField == nil { + break + } + + return e.complexity.Query.DirectiveField(childComplexity), true + case "Query.directiveInput": if e.complexity.Query.DirectiveInput == nil { break @@ -1397,6 +1408,7 @@ type EmbeddedDefaultScalar { directiveInputNullable(arg: InputDirectives): String directiveInput(arg: InputDirectives!): String directiveInputType(arg: InnerInput! @custom): String + directiveField: String inputSlice(arg: [String!]!): Boolean! shapeUnion: ShapeUnion! autobind: Autobind @@ -1502,6 +1514,8 @@ type EmbeddedPointer { directive @length(min: Int!, max: Int, message: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION directive @range(min: Int = 0, max: Int) on ARGUMENT_DEFINITION directive @custom on ARGUMENT_DEFINITION +directive @logged(id: UUID!) on FIELD +scalar UUID enum Status { OK @@ -1682,6 +1696,20 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str return args, nil } +func (ec *executionContext) dir_logged_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + arg0, err = ec.unmarshalNUUID2string(ctx, tmp) + if err != nil { + return nil, err + } + } + args["id"] = arg0 + return args, nil +} + func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} @@ -2268,6 +2296,31 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg // region ************************** directives.gotpl ************************** +func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { + rctx := graphql.GetResolverContext(ctx) + for _, d := range rctx.Field.Directives { + switch d.Name { + case "logged": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_logged_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return nil + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.Logged(ctx, obj, n, args["id"].(string)) + } + } + } + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + // endregion ************************** directives.gotpl ************************** // region **************************** field.gotpl ***************************** @@ -2289,14 +2342,11 @@ func (ec *executionContext) _A_id(ctx context.Context, field graphql.CollectedFi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2326,14 +2376,11 @@ func (ec *executionContext) _AIt_id(ctx context.Context, field graphql.Collected } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2363,14 +2410,11 @@ func (ec *executionContext) _AbIt_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2400,14 +2444,11 @@ func (ec *executionContext) _Autobind_int(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2437,14 +2478,11 @@ func (ec *executionContext) _Autobind_int32(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int32, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2474,14 +2512,11 @@ func (ec *executionContext) _Autobind_int64(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Int64, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2511,14 +2546,11 @@ func (ec *executionContext) _Autobind_idStr(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdStr, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2548,14 +2580,11 @@ func (ec *executionContext) _Autobind_idInt(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IdInt, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2585,14 +2614,11 @@ func (ec *executionContext) _B_id(ctx context.Context, field graphql.CollectedFi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2622,14 +2648,11 @@ func (ec *executionContext) _Circle_radius(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Radius, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2656,14 +2679,11 @@ func (ec *executionContext) _Circle_area(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2690,14 +2710,11 @@ func (ec *executionContext) _Content_Post_foo(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2724,14 +2741,11 @@ func (ec *executionContext) _Content_User_foo(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2758,14 +2772,11 @@ func (ec *executionContext) _EmbeddedDefaultScalar_value(ctx context.Context, fi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Value, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2792,14 +2803,11 @@ func (ec *executionContext) _EmbeddedPointer_ID(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2826,14 +2834,11 @@ func (ec *executionContext) _EmbeddedPointer_Title(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Title, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2860,14 +2865,11 @@ func (ec *executionContext) _Error_id(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2897,14 +2899,11 @@ func (ec *executionContext) _Error_errorOnNonRequiredField(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnNonRequiredField() }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -2931,14 +2930,11 @@ func (ec *executionContext) _Error_errorOnRequiredField(ctx context.Context, fie } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ErrorOnRequiredField() }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -2968,14 +2964,11 @@ func (ec *executionContext) _Error_nilOnRequiredField(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NilOnRequiredField(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3005,14 +2998,11 @@ func (ec *executionContext) _Errors_a(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().A(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3042,14 +3032,11 @@ func (ec *executionContext) _Errors_b(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().B(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3079,14 +3066,11 @@ func (ec *executionContext) _Errors_c(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().C(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3116,14 +3100,11 @@ func (ec *executionContext) _Errors_d(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().D(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3153,14 +3134,11 @@ func (ec *executionContext) _Errors_e(ctx context.Context, field graphql.Collect } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Errors().E(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3190,14 +3168,11 @@ func (ec *executionContext) _ForcedResolver_field(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ForcedResolver().Field(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -3224,14 +3199,11 @@ func (ec *executionContext) _InnerObject_id(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3261,14 +3233,11 @@ func (ec *executionContext) _InvalidIdentifier_id(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3298,14 +3267,11 @@ func (ec *executionContext) _It_id(ctx context.Context, field graphql.CollectedF } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3335,14 +3301,11 @@ func (ec *executionContext) _LoopA_b(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.B, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3372,14 +3335,11 @@ func (ec *executionContext) _LoopB_a(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.A, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3409,14 +3369,11 @@ func (ec *executionContext) _Map_id(ctx context.Context, field graphql.Collected } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3446,7 +3403,7 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["a"].(type) { case *string: @@ -3459,10 +3416,7 @@ func (ec *executionContext) _MapStringInterfaceType_a(ctx context.Context, field return nil, fmt.Errorf("unexpected type %T for field %s", v, "a") } }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -3489,7 +3443,7 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children switch v := obj["b"].(type) { case *int: @@ -3502,10 +3456,7 @@ func (ec *executionContext) _MapStringInterfaceType_b(ctx context.Context, field return nil, fmt.Errorf("unexpected type %T for field %s", v, "b") } }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -3532,14 +3483,11 @@ func (ec *executionContext) _ModelMethods_resolverField(ctx context.Context, fie } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.ModelMethods().ResolverField(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3569,14 +3517,11 @@ func (ec *executionContext) _ModelMethods_noContext(ctx context.Context, field g } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NoContext(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3606,14 +3551,11 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.WithContext(ctx), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3643,14 +3585,11 @@ func (ec *executionContext) _OuterObject_inner(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Inner, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3680,14 +3619,11 @@ func (ec *executionContext) _OverlappingFields_oneFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3717,14 +3653,11 @@ func (ec *executionContext) _OverlappingFields_twoFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Foo, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3754,14 +3687,11 @@ func (ec *executionContext) _OverlappingFields_oldFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.OverlappingFields().OldFoo(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3791,14 +3721,11 @@ func (ec *executionContext) _OverlappingFields_newFoo(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3828,14 +3755,11 @@ func (ec *executionContext) _OverlappingFields_new_foo(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.NewFoo, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3865,14 +3789,11 @@ func (ec *executionContext) _Panics_fieldScalarMarshal(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().FieldScalarMarshal(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3909,14 +3830,11 @@ func (ec *executionContext) _Panics_fieldFuncMarshal(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.FieldFuncMarshal(ctx, args["u"].([]MarshalPanic)), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3953,14 +3871,11 @@ func (ec *executionContext) _Panics_argUnmarshal(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Panics().ArgUnmarshal(rctx, obj, args["u"].([]MarshalPanic)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -3990,14 +3905,11 @@ func (ec *executionContext) _Primitive_value(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Primitive().Value(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4027,14 +3939,11 @@ func (ec *executionContext) _Primitive_squared(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Squared(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4064,14 +3973,11 @@ func (ec *executionContext) _PrimitiveString_value(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Value(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4101,14 +4007,11 @@ func (ec *executionContext) _PrimitiveString_doubled(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Doubled(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4138,14 +4041,11 @@ func (ec *executionContext) _PrimitiveString_len(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.PrimitiveString().Len(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4175,14 +4075,11 @@ func (ec *executionContext) _Query_invalidIdentifier(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InvalidIdentifier(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4209,14 +4106,11 @@ func (ec *executionContext) _Query_collision(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Collision(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4250,14 +4144,11 @@ func (ec *executionContext) _Query_mapInput(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapInput(rctx, args["input"].(map[string]interface{})) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4291,14 +4182,11 @@ func (ec *executionContext) _Query_recursive(ctx context.Context, field graphql. } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Recursive(rctx, args["input"].(*RecursiveInputSlice)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4332,14 +4220,11 @@ func (ec *executionContext) _Query_nestedInputs(ctx context.Context, field graph } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedInputs(rctx, args["input"].([][]*OuterInput)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4366,14 +4251,11 @@ func (ec *executionContext) _Query_nestedOutputs(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NestedOutputs(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4400,14 +4282,11 @@ func (ec *executionContext) _Query_shapes(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Shapes(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4434,14 +4313,11 @@ func (ec *executionContext) _Query_modelMethods(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ModelMethods(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4475,14 +4351,11 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().User(rctx, args["id"].(int)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4519,14 +4392,11 @@ func (ec *executionContext) _Query_nullableArg(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NullableArg(rctx, args["arg"].(*int)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4560,14 +4430,11 @@ func (ec *executionContext) _Query_directiveArg(ctx context.Context, field graph } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveArg(rctx, args["arg"].(string)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4601,14 +4468,11 @@ func (ec *executionContext) _Query_directiveNullableArg(ctx context.Context, fie } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveNullableArg(rctx, args["arg"].(*int), args["arg2"].(*int)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4642,14 +4506,11 @@ func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, f } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputNullable(rctx, args["arg"].(*InputDirectives)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4683,14 +4544,11 @@ func (ec *executionContext) _Query_directiveInput(ctx context.Context, field gra } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInput(rctx, args["arg"].(InputDirectives)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4724,14 +4582,42 @@ func (ec *executionContext) _Query_directiveInputType(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveInputType(rctx, args["arg"].(InnerInput)) }) - if err != nil { - ec.Error(ctx, err) + + if resTmp == nil { return graphql.Null } + res := resTmp.(*string) + rctx.Result = res + ctx = ec.Tracer.StartFieldChildExecution(ctx) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) +} + +func (ec *executionContext) _Query_directiveField(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + ctx = ec.Tracer.StartFieldExecution(ctx, field) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + ec.Tracer.EndFieldExecution(ctx) + }() + rctx := &graphql.ResolverContext{ + Object: "Query", + Field: field, + Args: nil, + IsMethod: true, + } + ctx = graphql.WithResolverContext(ctx, rctx) + ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Query().DirectiveField(rctx) + }) + if resTmp == nil { return graphql.Null } @@ -4765,14 +4651,11 @@ func (ec *executionContext) _Query_inputSlice(ctx context.Context, field graphql } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().InputSlice(rctx, args["arg"].([]string)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4802,14 +4685,11 @@ func (ec *executionContext) _Query_shapeUnion(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ShapeUnion(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4839,14 +4719,11 @@ func (ec *executionContext) _Query_autobind(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Autobind(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4873,14 +4750,11 @@ func (ec *executionContext) _Query_deprecatedField(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DeprecatedField(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -4910,14 +4784,11 @@ func (ec *executionContext) _Query_overlapping(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Overlapping(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4951,14 +4822,11 @@ func (ec *executionContext) _Query_mapStringInterface(ctx context.Context, field } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().MapStringInterface(rctx, args["in"].(map[string]interface{})) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -4985,14 +4853,11 @@ func (ec *executionContext) _Query_errorBubble(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ErrorBubble(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5019,14 +4884,11 @@ func (ec *executionContext) _Query_errors(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Errors(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5053,14 +4915,11 @@ func (ec *executionContext) _Query_valid(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Valid(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5090,14 +4949,11 @@ func (ec *executionContext) _Query_panics(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Panics(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5124,14 +4980,11 @@ func (ec *executionContext) _Query_primitiveObject(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveObject(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5161,14 +5014,11 @@ func (ec *executionContext) _Query_primitiveStringObject(ctx context.Context, fi } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().PrimitiveStringObject(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5205,14 +5055,11 @@ func (ec *executionContext) _Query_defaultScalar(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DefaultScalar(rctx, args["arg"].(string)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5242,14 +5089,11 @@ func (ec *executionContext) _Query_slices(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Slices(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5276,14 +5120,11 @@ func (ec *executionContext) _Query_scalarSlice(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ScalarSlice(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5320,14 +5161,11 @@ func (ec *executionContext) _Query_fallback(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Fallback(rctx, args["arg"].(FallbackToStringEncoding)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5357,14 +5195,11 @@ func (ec *executionContext) _Query_optionalUnion(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().OptionalUnion(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5391,14 +5226,11 @@ func (ec *executionContext) _Query_validType(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().ValidType(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5425,14 +5257,11 @@ func (ec *executionContext) _Query_wrappedStruct(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedStruct(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5462,14 +5291,11 @@ func (ec *executionContext) _Query_wrappedScalar(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().WrappedScalar(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5506,14 +5332,11 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5540,14 +5363,11 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5574,14 +5394,11 @@ func (ec *executionContext) _Rectangle_length(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Length, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5608,14 +5425,11 @@ func (ec *executionContext) _Rectangle_width(ctx context.Context, field graphql. } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Width, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5642,14 +5456,11 @@ func (ec *executionContext) _Rectangle_area(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Area(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5676,14 +5487,11 @@ func (ec *executionContext) _Slices_test1(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test1, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5710,14 +5518,11 @@ func (ec *executionContext) _Slices_test2(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test2, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -5744,14 +5549,11 @@ func (ec *executionContext) _Slices_test3(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test3, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5781,14 +5583,11 @@ func (ec *executionContext) _Slices_test4(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Test4, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5874,14 +5673,11 @@ func (ec *executionContext) _User_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5911,14 +5707,11 @@ func (ec *executionContext) _User_friends(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.User().Friends(rctx, obj) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5948,14 +5741,11 @@ func (ec *executionContext) _User_created(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Created, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -5985,14 +5775,11 @@ func (ec *executionContext) _User_updated(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Updated, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6019,14 +5806,11 @@ func (ec *executionContext) _ValidType_differentCase(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCase, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6056,14 +5840,11 @@ func (ec *executionContext) _ValidType_different_case(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DifferentCaseOld, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6100,14 +5881,11 @@ func (ec *executionContext) _ValidType_validInputKeywords(ctx context.Context, f } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidInputKeywords, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6144,14 +5922,11 @@ func (ec *executionContext) _ValidType_validArgs(ctx context.Context, field grap } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ValidArgs, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6181,14 +5956,11 @@ func (ec *executionContext) _WrappedStruct_name(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6218,14 +5990,11 @@ func (ec *executionContext) _XXIt_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6255,14 +6024,11 @@ func (ec *executionContext) _XxIt_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6292,14 +6058,11 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6329,14 +6092,11 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6363,14 +6123,11 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6400,14 +6157,11 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6437,14 +6191,11 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6474,14 +6225,11 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6508,14 +6256,11 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6545,14 +6290,11 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6579,14 +6321,11 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6616,14 +6355,11 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6650,14 +6386,11 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6687,14 +6420,11 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6724,14 +6454,11 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6761,14 +6488,11 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6795,14 +6519,11 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6832,14 +6553,11 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6866,14 +6584,11 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6903,14 +6618,11 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -6937,14 +6649,11 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -6974,14 +6683,11 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -7011,14 +6717,11 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7045,14 +6748,11 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7079,14 +6779,11 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -7116,14 +6813,11 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -7153,14 +6847,11 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7187,14 +6878,11 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7228,14 +6916,11 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7262,14 +6947,11 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7296,14 +6978,11 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7337,14 +7016,11 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7371,14 +7047,11 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7405,14 +7078,11 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -7439,14 +7109,11 @@ func (ec *executionContext) _asdfIt_id(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -7476,14 +7143,11 @@ func (ec *executionContext) _iIt_id(ctx context.Context, field graphql.Collected } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -9013,6 +8677,17 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr res = ec._Query_directiveInputType(ctx, field) return res }) + case "directiveField": + field := field + out.Concurrently(i, func() (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Query_directiveField(ctx, field) + return res + }) case "inputSlice": field := field out.Concurrently(i, func() (res graphql.Marshaler) { @@ -10280,6 +9955,20 @@ func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel as return res } +func (ec *executionContext) unmarshalNUUID2string(ctx context.Context, v interface{}) (string, error) { + return graphql.UnmarshalString(v) +} + +func (ec *executionContext) marshalNUUID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { + res := graphql.MarshalString(v) + if res == graphql.Null { + if !ec.HasError(graphql.GetResolverContext(ctx)) { + ec.Errorf(ctx, "must not be null") + } + } + return res +} + func (ec *executionContext) marshalNUser2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐUser(ctx context.Context, sel ast.SelectionSet, v User) graphql.Marshaler { return ec._User(ctx, sel, &v) } diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index e82ec74efae..ab8f7ec8bda 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -149,6 +149,9 @@ func (r *queryResolver) DirectiveInput(ctx context.Context, arg InputDirectives) func (r *queryResolver) DirectiveInputType(ctx context.Context, arg InnerInput) (*string, error) { panic("not implemented") } +func (r *queryResolver) DirectiveField(ctx context.Context) (*string, error) { + panic("not implemented") +} func (r *queryResolver) InputSlice(ctx context.Context, arg []string) (bool, error) { panic("not implemented") } diff --git a/codegen/testserver/schema.graphql b/codegen/testserver/schema.graphql index a230aefa374..e75b3bb2dc4 100644 --- a/codegen/testserver/schema.graphql +++ b/codegen/testserver/schema.graphql @@ -14,6 +14,7 @@ type Query { directiveInputNullable(arg: InputDirectives): String directiveInput(arg: InputDirectives!): String directiveInputType(arg: InnerInput! @custom): String + directiveField: String inputSlice(arg: [String!]!): Boolean! shapeUnion: ShapeUnion! autobind: Autobind @@ -119,6 +120,8 @@ type EmbeddedPointer { directive @length(min: Int!, max: Int, message: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION directive @range(min: Int = 0, max: Int) on ARGUMENT_DEFINITION directive @custom on ARGUMENT_DEFINITION +directive @logged(id: UUID!) on FIELD +scalar UUID enum Status { OK diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index 2537853f499..7b801e2cbc4 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -53,6 +53,7 @@ type Stub struct { DirectiveInputNullable func(ctx context.Context, arg *InputDirectives) (*string, error) DirectiveInput func(ctx context.Context, arg InputDirectives) (*string, error) DirectiveInputType func(ctx context.Context, arg InnerInput) (*string, error) + DirectiveField func(ctx context.Context) (*string, error) InputSlice func(ctx context.Context, arg []string) (bool, error) ShapeUnion func(ctx context.Context) (ShapeUnion, error) Autobind func(ctx context.Context) (*Autobind, error) @@ -221,6 +222,9 @@ func (r *stubQuery) DirectiveInput(ctx context.Context, arg InputDirectives) (*s func (r *stubQuery) DirectiveInputType(ctx context.Context, arg InnerInput) (*string, error) { return r.QueryResolver.DirectiveInputType(ctx, arg) } +func (r *stubQuery) DirectiveField(ctx context.Context) (*string, error) { + return r.QueryResolver.DirectiveField(ctx) +} func (r *stubQuery) InputSlice(ctx context.Context, arg []string) (bool, error) { return r.QueryResolver.InputSlice(ctx, arg) } diff --git a/example/todo/generated.go b/example/todo/generated.go index 9037c667161..fd0177c3414 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -260,7 +260,7 @@ scalar Map "Prevents access to a field if the user doesnt have the matching role" directive @hasRole(role: Role!) on FIELD_DEFINITION -directive @user(id: ID!) on MUTATION | QUERY +directive @user(id: ID!) on MUTATION | QUERY | FIELD enum Role { ADMIN @@ -457,6 +457,31 @@ func (ec *executionContext) _mutationMiddleware(ctx context.Context, obj *ast.Op } +func (ec *executionContext) _fieldMiddleware(ctx context.Context, obj interface{}, next graphql.Resolver) interface{} { + rctx := graphql.GetResolverContext(ctx) + for _, d := range rctx.Field.Directives { + switch d.Name { + case "user": + rawArgs := d.ArgumentMap(ec.Variables) + args, err := ec.dir_user_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return nil + } + n := next + next = func(ctx context.Context) (interface{}, error) { + return ec.directives.User(ctx, obj, n, args["id"].(int)) + } + } + } + res, err := ec.ResolverMiddleware(ctx, next) + if err != nil { + ec.Error(ctx, err) + return nil + } + return res +} + // endregion ************************** directives.gotpl ************************** // region **************************** field.gotpl ***************************** @@ -485,14 +510,11 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, args["todo"].(TodoInput)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -529,14 +551,11 @@ func (ec *executionContext) _MyMutation_updateTodo(ctx context.Context, field gr } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().UpdateTodo(rctx, args["id"].(int), args["changes"].(map[string]interface{})) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -570,14 +589,11 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, args["id"].(int)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -604,14 +620,11 @@ func (ec *executionContext) _MyQuery_lastTodo(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().LastTodo(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -638,14 +651,11 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -682,14 +692,11 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectType(args["name"].(string)) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -716,14 +723,11 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return ec.introspectSchema() }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -750,14 +754,11 @@ func (ec *executionContext) _Todo_id(ctx context.Context, field graphql.Collecte } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.ID, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -787,14 +788,11 @@ func (ec *executionContext) _Todo_text(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Text, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -824,7 +822,7 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { directive0 := func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Done, nil @@ -845,10 +843,7 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec } return nil, fmt.Errorf(`unexpected type %T from directive, should be bool`, tmp) }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -878,14 +873,11 @@ func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -915,14 +907,11 @@ func (ec *executionContext) ___Directive_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -949,14 +938,11 @@ func (ec *executionContext) ___Directive_locations(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Locations, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -986,14 +972,11 @@ func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1023,14 +1006,11 @@ func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1060,14 +1040,11 @@ func (ec *executionContext) ___EnumValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1094,14 +1071,11 @@ func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1131,14 +1105,11 @@ func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1165,14 +1136,11 @@ func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1202,14 +1170,11 @@ func (ec *executionContext) ___Field_description(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1236,14 +1201,11 @@ func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Args, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1273,14 +1235,11 @@ func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.Col } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1310,14 +1269,11 @@ func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.IsDeprecated(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1347,14 +1303,11 @@ func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DeprecationReason(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1381,14 +1334,11 @@ func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1418,14 +1368,11 @@ func (ec *executionContext) ___InputValue_description(ctx context.Context, field } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1452,14 +1399,11 @@ func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Type, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1489,14 +1433,11 @@ func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.DefaultValue, nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1523,14 +1464,11 @@ func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.C } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Types(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1560,14 +1498,11 @@ func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.QueryType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1597,14 +1532,11 @@ func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field gr } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.MutationType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1631,14 +1563,11 @@ func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, fiel } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.SubscriptionType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1665,14 +1594,11 @@ func (ec *executionContext) ___Schema_directives(ctx context.Context, field grap } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Directives(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1702,14 +1628,11 @@ func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Kind(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { if !ec.HasError(rctx) { ec.Errorf(ctx, "must not be null") @@ -1739,14 +1662,11 @@ func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.Coll } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Name(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1773,14 +1693,11 @@ func (ec *executionContext) ___Type_description(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Description(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1814,14 +1731,11 @@ func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.Co } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Fields(args["includeDeprecated"].(bool)), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1848,14 +1762,11 @@ func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphq } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.Interfaces(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1882,14 +1793,11 @@ func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field gra } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.PossibleTypes(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1923,14 +1831,11 @@ func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphq } rctx.Args = args ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.EnumValues(args["includeDeprecated"].(bool)), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1957,14 +1862,11 @@ func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graph } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.InputFields(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } @@ -1991,14 +1893,11 @@ func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.Co } ctx = graphql.WithResolverContext(ctx, rctx) ctx = ec.Tracer.StartFieldResolverExecution(ctx, rctx) - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { + resTmp := ec._fieldMiddleware(ctx, obj, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children return obj.OfType(), nil }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } + if resTmp == nil { return graphql.Null } diff --git a/example/todo/schema.graphql b/example/todo/schema.graphql index 41a4bd1aeee..8be7b292101 100644 --- a/example/todo/schema.graphql +++ b/example/todo/schema.graphql @@ -32,7 +32,7 @@ scalar Map "Prevents access to a field if the user doesnt have the matching role" directive @hasRole(role: Role!) on FIELD_DEFINITION -directive @user(id: ID!) on MUTATION | QUERY +directive @user(id: ID!) on MUTATION | QUERY | FIELD enum Role { ADMIN diff --git a/example/todo/todo_test.go b/example/todo/todo_test.go index 7a06c7977be..5bd188625b5 100644 --- a/example/todo/todo_test.go +++ b/example/todo/todo_test.go @@ -55,7 +55,7 @@ func TestTodo(t *testing.T) { require.Equal(t, "Very important", resp.UpdateTodo.Text) }) - t.Run("update the todo status by user id", func(t *testing.T) { + t.Run("update the todo status by user id in mutation", func(t *testing.T) { var resp struct { UpdateTodo struct { Text string @@ -67,6 +67,31 @@ func TestTodo(t *testing.T) { require.Equal(t, "Somebody else's todo", resp.UpdateTodo.Text) }) + t.Run("update the todo status by user id in field", func(t *testing.T) { + var resp struct { + UpdateTodo struct { + Text string + Done bool + } + } + c.MustPost(`mutation { updateTodo(id: 3, changes:{done:true})@user(id:2) { text, done } }`, &resp) + + require.Equal(t, "Somebody else's todo", resp.UpdateTodo.Text) + }) + + t.Run("failed update the todo status by user id in field", func(t *testing.T) { + var resp struct { + UpdateTodo *struct { + Text string + Done bool + } + } + err := c.Post(`mutation { updateTodo(id: 3, changes:{done:true}) { text, done } }`, &resp) + require.EqualError(t, err, "[{\"message\":\"you dont own that\",\"path\":[\"updateTodo\",\"done\"]}]") + + require.Nil(t, resp.UpdateTodo) + }) + t.Run("select with alias", func(t *testing.T) { var resp struct { A struct{ Text string } From d0db28ab9b1327bb539b57cd68a82835b48afc37 Mon Sep 17 00:00:00 2001 From: Franxois Date: Tue, 25 Jun 2019 15:08:36 +0200 Subject: [PATCH 29/30] Update dataloaders.md Make SQL request use requested IDs --- docs/content/reference/dataloaders.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/content/reference/dataloaders.md b/docs/content/reference/dataloaders.md index 1e1cd149c99..c478947bc94 100644 --- a/docs/content/reference/dataloaders.md +++ b/docs/content/reference/dataloaders.md @@ -102,7 +102,7 @@ func DataloaderMiddleware(db *sql.DB, next http.Handler) http.Handler { args := make([]interface{}, len(ids)) for i := 0; i < len(ids); i++ { placeholders[i] = "?" - args[i] = i + args[i] = ids[i] } res := logAndQuery(db, @@ -113,18 +113,21 @@ func DataloaderMiddleware(db *sql.DB, next http.Handler) http.Handler { defer res.Close() - users := make([]*User, len(ids)) - i := 0 + users := make(map[int]*User, len(ids)) for res.Next() { - users[i] = &User{} - err := res.Scan(&users[i].ID, &users[i].Name) + user := &User{} + err := res.Scan(&user.ID, &user.Name) if err != nil { panic(err) } - i++ + users[user.ID] = user } - - return users, nil + + output := make([]*User, len(ids)) + for i, id := range ids { + output[i] = users[id] + } + return output, nil }, } ctx := context.WithValue(r.Context(), userLoaderKey, &userloader) From 0fc822ca68f02fe7c510519ca91c7e0a131fbb99 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 26 Jun 2019 13:24:46 +1000 Subject: [PATCH 30/30] CircleCI workflows --- .circleci/{coverage.sh => check-coverage} | 3 +- .circleci/check-fmt | 10 +++ .circleci/check-generate | 11 +++ .../{integration.sh => check-integration} | 12 ++- .circleci/check-linting | 7 ++ .circleci/config.yml | 81 +++++++++---------- .circleci/golang.Dockerfile | 11 --- .circleci/node.Dockerfile | 9 --- .circleci/test.sh | 21 ----- 9 files changed, 76 insertions(+), 89 deletions(-) rename .circleci/{coverage.sh => check-coverage} (85%) create mode 100755 .circleci/check-fmt create mode 100755 .circleci/check-generate rename .circleci/{integration.sh => check-integration} (70%) create mode 100755 .circleci/check-linting delete mode 100644 .circleci/golang.Dockerfile delete mode 100644 .circleci/node.Dockerfile delete mode 100755 .circleci/test.sh diff --git a/.circleci/coverage.sh b/.circleci/check-coverage similarity index 85% rename from .circleci/coverage.sh rename to .circleci/check-coverage index e04e48401b9..cda0a4a4bab 100755 --- a/.circleci/coverage.sh +++ b/.circleci/check-coverage @@ -1,6 +1,7 @@ #!/bin/bash -set -eu +set -euo pipefail +go get github.com/mattn/goveralls go test -coverprofile=/tmp/coverage.out -coverpkg=./... $(go list github.com/99designs/gqlgen/... | grep -v server) goveralls -coverprofile=/tmp/coverage.out -service=circle-ci -repotoken=$REPOTOKEN -ignore='example/*/*,example/*/*/*,integration/*,integration/*/*,codegen/testserver/*' diff --git a/.circleci/check-fmt b/.circleci/check-fmt new file mode 100755 index 00000000000..cf68afec76e --- /dev/null +++ b/.circleci/check-fmt @@ -0,0 +1,10 @@ +#!/bin/bash + +set -euo pipefail + +go fmt ./... +if [[ $(git --no-pager diff) ]] ; then + echo "you need to run "go fmt" and commit the changes" + git --no-pager diff + exit 1 +fi diff --git a/.circleci/check-generate b/.circleci/check-generate new file mode 100755 index 00000000000..25bd59626dc --- /dev/null +++ b/.circleci/check-generate @@ -0,0 +1,11 @@ +#!/bin/bash + +set -euo pipefail + +go generate ./... + +if [[ $(git --no-pager diff) ]] ; then + echo "you need to run "go generate ./..." and commit the changes" + git --no-pager diff + exit 1 +fi diff --git a/.circleci/integration.sh b/.circleci/check-integration similarity index 70% rename from .circleci/integration.sh rename to .circleci/check-integration index d2e8935577d..97853567f04 100755 --- a/.circleci/integration.sh +++ b/.circleci/check-integration @@ -1,17 +1,21 @@ #!/bin/bash -set -eu +set -euo pipefail + +cd integration + +go run ./server/server.go & + +sleep 2 echo "### running jest integration spec" ./node_modules/.bin/jest --color echo "### validating introspected schema" -./node_modules/.bin/graphql get-schema +SERVER_URL=http://localhost:8080/query ./node_modules/.bin/graphql get-schema if ! diff <(tail -n +3 schema-expected.graphql) <(tail -n +3 schema-fetched.graphql) ; then echo "The expected schema has changed, you need to update schema-expected.graphql with any expected changes" exit 1 fi - - diff --git a/.circleci/check-linting b/.circleci/check-linting new file mode 100755 index 00000000000..5df207f656a --- /dev/null +++ b/.circleci/check-linting @@ -0,0 +1,7 @@ +#!/bin/bash + +set -euo pipefail + +curl -sL --fail https://github.com/golangci/golangci-lint/releases/download/v1.13/golangci-lint-1.13-linux-amd64.tar.gz | tar zxv --strip-components=1 --dir=/go/bin + +golangci-lint run diff --git a/.circleci/config.yml b/.circleci/config.yml index 199ef43e084..9d439bf2ce5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,52 +1,47 @@ version: 2 jobs: - build: - working_directory: /app + lint: docker: - - image: docker:18 + - image: circleci/golang:1.12 steps: - checkout - - setup_remote_docker: - docker_layer_caching: true - - run: - name: "docker build" - command: | - docker build -f .circleci/golang.Dockerfile -t gqlgen/golang . - docker build -f .circleci/node.Dockerfile -t gqlgen/node . + - run: go mod download + - run: .circleci/check-fmt + - run: .circleci/check-linting + - run: .circleci/check-generate - - run: - name: "coverage" - command: docker run -e REPOTOKEN --rm gqlgen/golang .circleci/coverage.sh - - - run: - name: "golang tests" - command: docker run --rm gqlgen/golang .circleci/test.sh - - - run: - name: "integration tests" - command: | - function cleanup { - echo "Cleaning up containers..." - docker kill $SERVER_CONTAINER 1>/dev/null 2>/dev/null || true - docker rm --force -v $SERVER_CONTAINER 1>/dev/null 2>/dev/null || true - } - trap cleanup EXIT - - SERVER_CONTAINER=$(docker run -d \ - -e PORT=1234 \ - --name integration_server \ - gqlgen/golang go run ./integration/server/server.go \ - ) - - sleep 20 - - docker run \ - -e SERVER_URL=http://integration_server:1234/query \ - --link=integration_server \ - gqlgen/node ../.circleci/integration.sh + test: + docker: + - image: circleci/golang:1.12 + steps: + - checkout + - run: go mod download + - run: go test -race ./... - echo "### server logs" - docker logs $SERVER_CONTAINER + cover: + docker: + - image: circleci/golang:1.12 + steps: + - checkout + - run: go mod download + - run: .circleci/check-coverage - exit $(docker inspect $SERVER_CONTAINER --format='{{.State.ExitCode}}') + integration: + docker: + - image: alpine:3.10 + steps: + - checkout + - run: apk add --no-cache --no-progress nodejs npm go musl-dev git bash + - run: go mod download + - run: cd integration ; npm install + - run: .circleci/check-integration + +workflows: + version: 2 + build_and_test: + jobs: + - lint + - test + - cover + - integration diff --git a/.circleci/golang.Dockerfile b/.circleci/golang.Dockerfile deleted file mode 100644 index 54673182cb8..00000000000 --- a/.circleci/golang.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM golang:1.11 - -RUN curl -sL --fail https://github.com/golangci/golangci-lint/releases/download/v1.13/golangci-lint-1.13-linux-amd64.tar.gz | tar zxv --strip-components=1 --dir=/go/bin -RUN go get github.com/mattn/goveralls - -WORKDIR /projects/gqlgen - -COPY go.* /projects/gqlgen/ -RUN go mod download - -COPY . /projects/gqlgen/ diff --git a/.circleci/node.Dockerfile b/.circleci/node.Dockerfile deleted file mode 100644 index 010a5f5d005..00000000000 --- a/.circleci/node.Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM node:10 - -WORKDIR /gqlgen/integration - - -COPY integration/package*.json /gqlgen/integration/ -RUN npm ci - -COPY . /gqlgen/ diff --git a/.circleci/test.sh b/.circleci/test.sh deleted file mode 100755 index 37b0e9dc6a9..00000000000 --- a/.circleci/test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -eu - -echo "### go code formatting" -go fmt ./... - -echo "### go generating" -go generate ./... - -if [[ $(git --no-pager diff) ]] ; then - echo "you need to run `go fmt` or `go generate`" - git --no-pager diff - exit 1 -fi - -echo "### running testsuite" -go test -race ./... - -echo "### linting" -golangci-lint run