diff --git a/_examples/chat/generated.go b/_examples/chat/generated.go index a9c7fb0ee1..3721976bad 100644 --- a/_examples/chat/generated.go +++ b/_examples/chat/generated.go @@ -740,7 +740,6 @@ func (ec *executionContext) _Mutation_post(ctx context.Context, field graphql.Co }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -805,7 +804,6 @@ func (ec *executionContext) _Query_room(ctx context.Context, field graphql.Colle }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -863,7 +861,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -937,7 +934,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -992,7 +988,6 @@ func (ec *executionContext) _Subscription_messageAdded(ctx context.Context, fiel }) if err != nil { ec.Error(ctx, err) - return nil } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -2927,7 +2922,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2943,17 +2937,11 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_post(ctx, field) }) - 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 } @@ -2966,7 +2954,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3013,9 +3000,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/config/generated.go b/_examples/config/generated.go index 37f497fd5f..abf2990a15 100644 --- a/_examples/config/generated.go +++ b/_examples/config/generated.go @@ -359,7 +359,6 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -426,7 +425,6 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -482,7 +480,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -556,7 +553,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2827,7 +2823,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2843,17 +2838,11 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_createTodo(ctx, field) }) - 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 } @@ -2866,7 +2855,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2886,9 +2874,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_todos(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2916,9 +2901,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/dataloader/generated.go b/_examples/dataloader/generated.go index d8c6559b97..14fc5fda96 100644 --- a/_examples/dataloader/generated.go +++ b/_examples/dataloader/generated.go @@ -933,7 +933,6 @@ func (ec *executionContext) _Query_customers(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -984,7 +983,6 @@ func (ec *executionContext) _Query_torture1d(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1046,7 +1044,6 @@ func (ec *executionContext) _Query_torture2d(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1108,7 +1105,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1182,7 +1178,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -3207,7 +3202,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3294,9 +3288,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/embedding/subdir/gendir/generated.go b/_examples/embedding/subdir/gendir/generated.go index eae119fdf2..ef6d293a9e 100644 --- a/_examples/embedding/subdir/gendir/generated.go +++ b/_examples/embedding/subdir/gendir/generated.go @@ -9,7 +9,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" @@ -273,7 +272,6 @@ func (ec *executionContext) _Query_inSchemadir(ctx context.Context, field graphq }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -317,7 +315,6 @@ func (ec *executionContext) _Query_parentdir(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -361,7 +358,6 @@ func (ec *executionContext) _Query_subdir(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -405,7 +401,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -453,7 +448,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -527,7 +521,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2395,7 +2388,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2415,9 +2407,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_inSchemadir(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2438,9 +2427,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_parentdir(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2461,9 +2447,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_subdir(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2484,9 +2467,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2514,9 +2494,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/embedding/subdir/root.generated.go b/_examples/embedding/subdir/root.generated.go index ba4783427c..4fc1025add 100644 --- a/_examples/embedding/subdir/root.generated.go +++ b/_examples/embedding/subdir/root.generated.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "strconv" - "sync/atomic" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" @@ -68,7 +67,6 @@ func (ec *executionContext) _Query_inSchemadir(ctx context.Context, field graphq }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -112,7 +110,6 @@ func (ec *executionContext) _Query_parentdir(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -156,7 +153,6 @@ func (ec *executionContext) _Query_subdir(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -200,7 +196,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -248,7 +243,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -322,7 +316,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -380,7 +373,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -400,9 +392,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_inSchemadir(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -423,9 +412,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_parentdir(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -446,9 +432,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_subdir(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -469,9 +452,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -499,9 +479,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/federation/accounts/graph/generated.go b/_examples/federation/accounts/graph/generated.go index 3a364c7109..34c55aba63 100644 --- a/_examples/federation/accounts/graph/generated.go +++ b/_examples/federation/accounts/graph/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/_examples/federation/accounts/graph/model" "github.com/99designs/gqlgen/graphql" @@ -502,7 +501,6 @@ func (ec *executionContext) _Entity_findEmailHostByID(ctx context.Context, field }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -563,7 +561,6 @@ func (ec *executionContext) _Entity_findUserByID(ctx context.Context, field grap }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -628,7 +625,6 @@ func (ec *executionContext) _Query_me(ctx context.Context, field graphql.Collect }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -679,7 +675,6 @@ func (ec *executionContext) _Query__entities(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -734,7 +729,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -782,7 +776,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -856,7 +849,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2964,7 +2956,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2984,9 +2975,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findEmailHostByID(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3007,9 +2995,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findUserByID(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3025,9 +3010,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } @@ -3040,7 +3022,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3080,9 +3061,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__entities(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3103,9 +3081,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3133,9 +3108,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/federation/products/graph/generated.go b/_examples/federation/products/graph/generated.go index e056e53c7e..882dc44f61 100644 --- a/_examples/federation/products/graph/generated.go +++ b/_examples/federation/products/graph/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/_examples/federation/products/graph/model" "github.com/99designs/gqlgen/graphql" @@ -481,7 +480,6 @@ func (ec *executionContext) _Entity_findManufacturerByID(ctx context.Context, fi }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -542,7 +540,6 @@ func (ec *executionContext) _Entity_findProductByManufacturerIDAndID(ctx context }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -609,7 +606,6 @@ func (ec *executionContext) _Entity_findProductByUpc(ctx context.Context, field }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -990,7 +986,6 @@ func (ec *executionContext) _Query_topProducts(ctx context.Context, field graphq }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1054,7 +1049,6 @@ func (ec *executionContext) _Query__entities(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1109,7 +1103,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1157,7 +1150,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1231,7 +1223,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -3122,7 +3113,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3142,9 +3132,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findManufacturerByID(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3165,9 +3152,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findProductByManufacturerIDAndID(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3188,9 +3172,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findProductByUpc(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3206,9 +3187,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } @@ -3312,7 +3290,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3352,9 +3329,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__entities(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3375,9 +3349,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3405,9 +3376,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/federation/reviews/graph/generated.go b/_examples/federation/reviews/graph/generated.go index 71fa9bf2c0..73393a844b 100644 --- a/_examples/federation/reviews/graph/generated.go +++ b/_examples/federation/reviews/graph/generated.go @@ -516,7 +516,6 @@ func (ec *executionContext) _Entity_findProductByManufacturerIDAndID(ctx context }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -579,7 +578,6 @@ func (ec *executionContext) _Entity_findUserByID(ctx context.Context, field grap }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -829,7 +827,6 @@ func (ec *executionContext) _Query__entities(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -884,7 +881,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -932,7 +928,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1006,7 +1001,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -3274,7 +3268,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3294,9 +3287,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findProductByManufacturerIDAndID(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3317,9 +3307,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findUserByID(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3335,9 +3322,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } @@ -3417,7 +3401,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3437,9 +3420,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__entities(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3460,9 +3440,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3490,9 +3467,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/fileupload/generated.go b/_examples/fileupload/generated.go index b8ea7004a9..5a52ebcf4b 100644 --- a/_examples/fileupload/generated.go +++ b/_examples/fileupload/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/_examples/fileupload/model" "github.com/99designs/gqlgen/graphql" @@ -567,7 +566,6 @@ func (ec *executionContext) _Mutation_singleUpload(ctx context.Context, field gr }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -632,7 +630,6 @@ func (ec *executionContext) _Mutation_singleUploadWithPayload(ctx context.Contex }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -697,7 +694,6 @@ func (ec *executionContext) _Mutation_multipleUpload(ctx context.Context, field }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -762,7 +758,6 @@ func (ec *executionContext) _Mutation_multipleUploadWithPayload(ctx context.Cont }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -827,7 +822,6 @@ func (ec *executionContext) _Query_empty(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -871,7 +865,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -945,7 +938,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2857,7 +2849,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2873,44 +2864,29 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_singleUpload(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "singleUploadWithPayload": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_singleUploadWithPayload(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "multipleUpload": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_multipleUpload(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "multipleUploadWithPayload": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_multipleUploadWithPayload(ctx, field) }) - 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 } @@ -2923,7 +2899,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2943,9 +2918,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_empty(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2973,9 +2945,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/scalars/generated.go b/_examples/scalars/generated.go index e74062808c..015946e40d 100644 --- a/_examples/scalars/generated.go +++ b/_examples/scalars/generated.go @@ -508,7 +508,6 @@ func (ec *executionContext) _Query_user(ctx context.Context, field graphql.Colle }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -584,7 +583,6 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -663,7 +661,6 @@ func (ec *executionContext) _Query_userByTier(ctx context.Context, field graphql }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -742,7 +739,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -816,7 +812,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -3191,7 +3186,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3231,9 +3225,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_search(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3254,9 +3245,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_userByTier(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3284,9 +3272,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/selection/generated.go b/_examples/selection/generated.go index 96cfece215..b2218c5e1f 100644 --- a/_examples/selection/generated.go +++ b/_examples/selection/generated.go @@ -626,7 +626,6 @@ func (ec *executionContext) _Query_events(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -667,7 +666,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -741,7 +739,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2677,7 +2674,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2724,9 +2720,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/starwars/generated/exec.go b/_examples/starwars/generated/exec.go index c7d8c4916c..0623039526 100644 --- a/_examples/starwars/generated/exec.go +++ b/_examples/starwars/generated/exec.go @@ -1914,7 +1914,6 @@ func (ec *executionContext) _Mutation_createReview(ctx context.Context, field gr }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2106,7 +2105,6 @@ func (ec *executionContext) _Query_hero(ctx context.Context, field graphql.Colle }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2158,7 +2156,6 @@ func (ec *executionContext) _Query_reviews(ctx context.Context, field graphql.Co }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -2221,7 +2218,6 @@ func (ec *executionContext) _Query_search(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -2276,7 +2272,6 @@ func (ec *executionContext) _Query_character(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2328,7 +2323,6 @@ func (ec *executionContext) _Query_droid(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2394,7 +2388,6 @@ func (ec *executionContext) _Query_human(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2464,7 +2457,6 @@ func (ec *executionContext) _Query_starship(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2526,7 +2518,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2600,7 +2591,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -5128,7 +5118,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -5149,9 +5138,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } @@ -5206,7 +5192,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -5246,9 +5231,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_reviews(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -5269,9 +5251,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_search(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -5379,9 +5358,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/todo/generated.go b/_examples/todo/generated.go index 196e9542b9..e7f9f5da1a 100644 --- a/_examples/todo/generated.go +++ b/_examples/todo/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" @@ -2743,7 +2742,6 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2759,9 +2757,6 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe return ec._MyMutation_createTodo(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "updateTodo": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -2773,9 +2768,6 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } @@ -2788,7 +2780,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2848,9 +2839,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) } }() res = ec._MyQuery_todos(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2878,9 +2866,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/_examples/type-system-extension/generated.go b/_examples/type-system-extension/generated.go index 20ef22b322..2d5cba1bca 100644 --- a/_examples/type-system-extension/generated.go +++ b/_examples/type-system-extension/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" @@ -367,7 +366,6 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -452,7 +450,6 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -526,7 +523,6 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -588,7 +584,6 @@ func (ec *executionContext) _MyQuery___type(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -662,7 +657,6 @@ func (ec *executionContext) _MyQuery___schema(ctx context.Context, field graphql }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2759,7 +2753,6 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2775,17 +2768,11 @@ func (ec *executionContext) _MyMutation(ctx context.Context, sel ast.SelectionSe return ec._MyMutation_createTodo(ctx, field) }) - 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 } @@ -2798,7 +2785,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2818,9 +2804,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) } }() res = ec._MyQuery_todos(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2868,9 +2851,6 @@ func (ec *executionContext) _MyQuery(ctx context.Context, sel ast.SelectionSet) } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/api/testdata/default/graph/generated.go b/api/testdata/default/graph/generated.go index bdb4c6309c..d463826db2 100644 --- a/api/testdata/default/graph/generated.go +++ b/api/testdata/default/graph/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/api/testdata/default/graph/model" "github.com/99designs/gqlgen/graphql" @@ -323,7 +322,6 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -388,7 +386,6 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -442,7 +439,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -516,7 +512,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2649,7 +2644,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2665,17 +2659,11 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_createTodo(ctx, field) }) - 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 } @@ -2688,7 +2676,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2708,9 +2695,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_todos(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2738,9 +2722,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/api/testdata/federation2/graph/generated.go b/api/testdata/federation2/graph/generated.go index ed0489a8fd..966d4b3979 100644 --- a/api/testdata/federation2/graph/generated.go +++ b/api/testdata/federation2/graph/generated.go @@ -10,7 +10,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/api/testdata/federation2/graph/model" "github.com/99designs/gqlgen/graphql" @@ -368,7 +367,6 @@ func (ec *executionContext) _Mutation_createTodo(ctx context.Context, field grap }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -433,7 +431,6 @@ func (ec *executionContext) _Query_todos(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -487,7 +484,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -535,7 +531,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -609,7 +604,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -2783,7 +2777,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2799,17 +2792,11 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_createTodo(ctx, field) }) - 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 } @@ -2822,7 +2809,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -2842,9 +2828,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_todos(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2865,9 +2848,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -2895,9 +2875,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/codegen/field.gotpl b/codegen/field.gotpl index e47b958dda..3daaa596f0 100644 --- a/codegen/field.gotpl +++ b/codegen/field.gotpl @@ -26,7 +26,9 @@ func (ec *executionContext) _{{$object.Name}}_{{$field.Name}}(ctx context.Contex }) if err != nil { ec.Error(ctx, err) - return {{ $null }} + {{- if not $object.Root }} + return {{ $null }} + {{- end }} } {{- end }} if resTmp == nil { diff --git a/codegen/object.gotpl b/codegen/object.gotpl index 1fbdfacec1..ab31beb718 100644 --- a/codegen/object.gotpl +++ b/codegen/object.gotpl @@ -31,7 +31,9 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec }) {{end}} out := graphql.NewFieldSet(fields) - var invalids uint32 + {{- if not $object.Root }} + var invalids uint32 + {{- end }} for i, field := range fields { {{- if $object.Root }} innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ @@ -54,14 +56,16 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec } }() res = ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}}) - {{- if $field.TypeReference.GQL.NonNull }} - if res == graphql.Null { - {{- if $object.IsConcurrent }} - atomic.AddUint32(&invalids, 1) - {{- else }} - invalids++ - {{- end }} - } + {{- if not $object.Root }} + {{- if $field.TypeReference.GQL.NonNull }} + if res == graphql.Null { + {{- if $object.IsConcurrent }} + atomic.AddUint32(&invalids, 1) + {{- else }} + invalids++ + {{- end }} + } + {{- end }} {{- end }} return res } @@ -88,14 +92,16 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field, obj) {{end}} - {{- if $field.TypeReference.GQL.NonNull }} - if out.Values[i] == graphql.Null { - {{- if $object.IsConcurrent }} - atomic.AddUint32(&invalids, 1) - {{- else }} - invalids++ - {{- end }} - } + {{- if not $object.Root }} + {{- if $field.TypeReference.GQL.NonNull }} + if out.Values[i] == graphql.Null { + {{- if $object.IsConcurrent }} + atomic.AddUint32(&invalids, 1) + {{- else }} + invalids++ + {{- end }} + } + {{- end }} {{- end }} {{- end }} {{- end }} @@ -104,7 +110,9 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec } } out.Dispatch() - if invalids > 0 { return graphql.Null } + {{- if not $object.Root }} + if invalids > 0 { return graphql.Null } + {{- end }} return out } {{- end }} diff --git a/codegen/testserver/followschema/defaults.generated.go b/codegen/testserver/followschema/defaults.generated.go index 0705293de8..d37844b14e 100644 --- a/codegen/testserver/followschema/defaults.generated.go +++ b/codegen/testserver/followschema/defaults.generated.go @@ -488,7 +488,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -504,44 +503,29 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_defaultInput(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "overrideValueViaInput": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_overrideValueViaInput(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "updateSomething": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updateSomething(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "updatePtrToPtr": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updatePtrToPtr(ctx, field) }) - 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 } diff --git a/codegen/testserver/followschema/schema.generated.go b/codegen/testserver/followschema/schema.generated.go index 717b8c253d..7e025ea314 100644 --- a/codegen/testserver/followschema/schema.generated.go +++ b/codegen/testserver/followschema/schema.generated.go @@ -5934,7 +5934,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -6094,9 +6093,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_user(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6137,9 +6133,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_inputSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6160,9 +6153,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_inputNullableSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6183,9 +6173,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_shapeUnion(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6226,9 +6213,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_deprecatedField(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6269,9 +6253,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_defaultParameters(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6432,9 +6413,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_directiveFieldDef(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6575,9 +6553,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_enumInInput(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6638,9 +6613,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_node(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6881,9 +6853,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_valid(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6924,9 +6893,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_primitiveObject(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6947,9 +6913,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_primitiveStringObject(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6970,9 +6933,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_ptrToSliceContainer(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6993,9 +6953,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_infinity(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7016,9 +6973,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_stringFromContextInterface(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7039,9 +6993,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_stringFromContextFunction(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7062,9 +7013,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_defaultScalar(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7105,9 +7053,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_scalarSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7128,9 +7073,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_fallback(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7251,9 +7193,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedStruct(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7274,9 +7213,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedScalar(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7297,9 +7233,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedMap(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7320,9 +7253,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -7350,9 +7280,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/codegen/testserver/singlefile/generated.go b/codegen/testserver/singlefile/generated.go index 3b220006e5..5397511285 100644 --- a/codegen/testserver/singlefile/generated.go +++ b/codegen/testserver/singlefile/generated.go @@ -16308,7 +16308,6 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -16324,44 +16323,29 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) return ec._Mutation_defaultInput(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "overrideValueViaInput": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_overrideValueViaInput(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "updateSomething": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updateSomething(ctx, field) }) - if out.Values[i] == graphql.Null { - invalids++ - } case "updatePtrToPtr": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Mutation_updatePtrToPtr(ctx, field) }) - 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 } @@ -16873,7 +16857,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -17033,9 +17016,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_user(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17076,9 +17056,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_inputSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17099,9 +17076,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_inputNullableSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17122,9 +17096,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_shapeUnion(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17165,9 +17136,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_deprecatedField(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17208,9 +17176,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_defaultParameters(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17371,9 +17336,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_directiveFieldDef(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17514,9 +17476,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_enumInInput(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17577,9 +17536,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_node(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17820,9 +17776,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_valid(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17863,9 +17816,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_primitiveObject(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17886,9 +17836,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_primitiveStringObject(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17909,9 +17856,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_ptrToSliceContainer(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17932,9 +17876,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_infinity(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17955,9 +17896,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_stringFromContextInterface(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -17978,9 +17916,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_stringFromContextFunction(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18001,9 +17936,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_defaultScalar(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18044,9 +17976,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_scalarSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18067,9 +17996,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_fallback(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18190,9 +18116,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedStruct(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18213,9 +18136,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedScalar(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18236,9 +18156,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedMap(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18259,9 +18176,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_wrappedSlice(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -18289,9 +18203,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/integration/generated.go b/integration/generated.go index 5686d6907e..aa3366bfd0 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -589,7 +589,6 @@ func (ec *executionContext) _Query_path(ctx context.Context, field graphql.Colle }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -638,7 +637,6 @@ func (ec *executionContext) _Query_date(ctx context.Context, field graphql.Colle }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -693,7 +691,6 @@ func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -738,7 +735,6 @@ func (ec *executionContext) _Query_jsonEncoding(ctx context.Context, field graph }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -782,7 +778,6 @@ func (ec *executionContext) _Query_error(ctx context.Context, field graphql.Coll }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -837,7 +832,6 @@ func (ec *executionContext) _Query_complexity(ctx context.Context, field graphql }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -892,7 +886,6 @@ func (ec *executionContext) _Query_coercion(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -947,7 +940,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1021,7 +1013,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -3205,7 +3196,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -3245,9 +3235,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_date(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3288,9 +3275,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_jsonEncoding(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3311,9 +3295,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_error(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3334,9 +3315,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_complexity(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3357,9 +3335,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query_coercion(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -3387,9 +3362,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/plugin/federation/testdata/entityresolver/generated/exec.go b/plugin/federation/testdata/entityresolver/generated/exec.go index a4b3514fed..1a8d9753b6 100644 --- a/plugin/federation/testdata/entityresolver/generated/exec.go +++ b/plugin/federation/testdata/entityresolver/generated/exec.go @@ -9,7 +9,6 @@ import ( "fmt" "strconv" "sync" - "sync/atomic" "github.com/99designs/gqlgen/graphql" "github.com/99designs/gqlgen/graphql/introspection" @@ -1185,7 +1184,6 @@ func (ec *executionContext) _Entity_findHelloByName(ctx context.Context, field g }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1246,7 +1244,6 @@ func (ec *executionContext) _Entity_findHelloMultiSingleKeysByKey1AndKey2(ctx co }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1307,7 +1304,6 @@ func (ec *executionContext) _Entity_findHelloWithErrorsByName(ctx context.Contex }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1390,7 +1386,6 @@ func (ec *executionContext) _Entity_findManyMultiHelloByNames(ctx context.Contex }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1470,7 +1465,6 @@ func (ec *executionContext) _Entity_findManyMultiHelloMultipleRequiresByNames(ct }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1556,7 +1550,6 @@ func (ec *executionContext) _Entity_findManyMultiHelloRequiresByNames(ctx contex }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1640,7 +1633,6 @@ func (ec *executionContext) _Entity_findManyMultiHelloWithErrorByNames(ctx conte }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1720,7 +1712,6 @@ func (ec *executionContext) _Entity_findManyMultiPlanetRequiresNestedByNames(ctx }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -1780,7 +1771,6 @@ func (ec *executionContext) _Entity_findPlanetMultipleRequiresByName(ctx context }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1845,7 +1835,6 @@ func (ec *executionContext) _Entity_findPlanetRequiresByName(ctx context.Context }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1908,7 +1897,6 @@ func (ec *executionContext) _Entity_findPlanetRequiresNestedByName(ctx context.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -1971,7 +1959,6 @@ func (ec *executionContext) _Entity_findWorldByHelloNameAndFoo(ctx context.Conte }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -2034,7 +2021,6 @@ func (ec *executionContext) _Entity_findWorldNameByName(ctx context.Context, fie }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -2093,7 +2079,6 @@ func (ec *executionContext) _Entity_findWorldWithMultipleKeysByHelloNameAndFoo(c }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -2156,7 +2141,6 @@ func (ec *executionContext) _Entity_findWorldWithMultipleKeysByBar(ctx context.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -3423,7 +3407,6 @@ func (ec *executionContext) _Query__entities(ctx context.Context, field graphql. }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -3478,7 +3461,6 @@ func (ec *executionContext) _Query__service(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { if !graphql.HasFieldError(ctx, fc) { @@ -3526,7 +3508,6 @@ func (ec *executionContext) _Query___type(ctx context.Context, field graphql.Col }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -3600,7 +3581,6 @@ func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.C }) if err != nil { ec.Error(ctx, err) - return graphql.Null } if resTmp == nil { return graphql.Null @@ -6029,7 +6009,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -6049,9 +6028,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findHelloByName(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6072,9 +6048,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findHelloMultiSingleKeysByKey1AndKey2(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6095,9 +6068,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findHelloWithErrorsByName(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6218,9 +6188,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findPlanetMultipleRequiresByName(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6241,9 +6208,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findPlanetRequiresByName(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6264,9 +6228,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findPlanetRequiresNestedByName(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6287,9 +6248,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findWorldByHelloNameAndFoo(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6310,9 +6268,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findWorldNameByName(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6333,9 +6288,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findWorldWithMultipleKeysByHelloNameAndFoo(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6356,9 +6308,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } }() res = ec._Entity_findWorldWithMultipleKeysByBar(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6374,9 +6323,6 @@ func (ec *executionContext) _Entity(ctx context.Context, sel ast.SelectionSet) g } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } @@ -6809,7 +6755,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr }) out := graphql.NewFieldSet(fields) - var invalids uint32 for i, field := range fields { innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ Object: field.Name, @@ -6829,9 +6774,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__entities(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6852,9 +6794,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } }() res = ec._Query__service(ctx, field) - if res == graphql.Null { - atomic.AddUint32(&invalids, 1) - } return res } @@ -6882,9 +6821,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr } } out.Dispatch() - if invalids > 0 { - return graphql.Null - } return out } diff --git a/plugin/resolvergen/testdata/filetemplate/out/schema.custom.go b/plugin/resolvergen/testdata/filetemplate/out/schema.custom.go index 7b08f087fa..80eb3a5406 100644 --- a/plugin/resolvergen/testdata/filetemplate/out/schema.custom.go +++ b/plugin/resolvergen/testdata/filetemplate/out/schema.custom.go @@ -2,7 +2,7 @@ package customresolver // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.21-dev DO NOT EDIT. +// Code generated by github.com/99designs/gqlgen version v0.17.22-dev import ( "context" diff --git a/plugin/resolvergen/testdata/followschema/out/schema.resolvers.go b/plugin/resolvergen/testdata/followschema/out/schema.resolvers.go index 7b08f087fa..80eb3a5406 100644 --- a/plugin/resolvergen/testdata/followschema/out/schema.resolvers.go +++ b/plugin/resolvergen/testdata/followschema/out/schema.resolvers.go @@ -2,7 +2,7 @@ package customresolver // This file will be automatically regenerated based on the schema, any resolver implementations // will be copied through when generating and any unknown code will be moved to the end. -// Code generated by github.com/99designs/gqlgen version v0.17.21-dev DO NOT EDIT. +// Code generated by github.com/99designs/gqlgen version v0.17.22-dev import ( "context"