From d98ff1b04ca102e74037ac914dddb595aa9c6808 Mon Sep 17 00:00:00 2001 From: Bogdan Dumitru Date: Thu, 19 Mar 2020 14:45:55 +0100 Subject: [PATCH 1/7] Modify templates to include deeper context nesting --- codegen/args.gotpl | 7 +-- codegen/generated!.gotpl | 1 + codegen/input.gotpl | 8 ++-- codegen/type.gotpl | 13 +++++- graphql/context_field_input.go | 66 +++++++++++++++++++++++++++++ graphql/context_field_input_test.go | 15 +++++++ 6 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 graphql/context_field_input.go create mode 100644 graphql/context_field_input_test.go diff --git a/codegen/args.gotpl b/codegen/args.gotpl index 318f1ff451b..afe58032801 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -5,10 +5,11 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] {{- range $i, $arg := . }} var arg{{$i}} {{ $arg.TypeReference.GO | ref}} if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField({{$arg.Name|quote}})) {{- if $arg.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(childCtx, tmp) } {{ template "implDirectives" $arg }} - tmp, err = directive{{$arg.ImplDirectives|len}}(ctx) + tmp, err = directive{{$arg.ImplDirectives|len}}(childCtx) if err != nil { return nil, err } @@ -22,7 +23,7 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp) } {{- else }} - arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) + arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(childCtx, tmp) if err != nil { return nil, err } diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 03be286e1e1..ed68c25adb8 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -10,6 +10,7 @@ {{ reserveImport "github.com/vektah/gqlparser/v2" }} {{ reserveImport "github.com/vektah/gqlparser/v2/ast" }} +{{ reserveImport "github.com/vektah/gqlparser/v2/gqlerror" }} {{ reserveImport "github.com/99designs/gqlgen/graphql" }} {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} diff --git a/codegen/input.gotpl b/codegen/input.gotpl index bdf3622caf1..815f466bb8f 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -16,10 +16,12 @@ {{- range $field := .Fields }} case {{$field.Name|quote}}: var err error + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField({{$field.Name|quote}})) {{- if $field.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(childCtx, v) } {{ template "implDirectives" $field }} - tmp, err := directive{{$field.ImplDirectives|len}}(ctx) + tmp, err := directive{{$field.ImplDirectives|len}}(childCtx) if err != nil { return it, err } @@ -33,7 +35,7 @@ return it, fmt.Errorf(`unexpected type %T from directive, should be {{ $field.TypeReference.GO }}`, tmp) } {{- else }} - it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) + it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(childCtx, v) if err != nil { return it, err } diff --git a/codegen/type.gotpl b/codegen/type.gotpl index d4e95a475c2..06a285e3f57 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -37,7 +37,18 @@ return v.(map[string]interface{}), nil {{- else if $type.IsMarshaler }} var res {{ $type.GO | ref }} - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil {{- else }} return ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v) {{- end }} diff --git a/graphql/context_field_input.go b/graphql/context_field_input.go new file mode 100644 index 00000000000..37a0319b7b2 --- /dev/null +++ b/graphql/context_field_input.go @@ -0,0 +1,66 @@ +package graphql + +import ( + "context" + "github.com/vektah/gqlparser/v2/ast" +) + +const fieldInputCtx key = "field_input_context" + +type FieldInputContext struct { + ParentField *FieldContext + ParentInput *FieldInputContext + Field *string + Index *int +} + +func (fic *FieldInputContext) Path() ast.Path { + var inputPath ast.Path + for it := fic; it != nil; it = it.ParentInput { + if it.Index != nil { + inputPath = append(inputPath, ast.PathIndex(*it.Index)) + } else if it.Field != nil { + inputPath = append(inputPath, ast.PathName(*it.Field)) + } + } + + // because we are walking up the chain, all the elements are backwards, do an inplace flip. + for i := len(inputPath)/2 - 1; i >= 0; i-- { + opp := len(inputPath) - 1 - i + inputPath[i], inputPath[opp] = inputPath[opp], inputPath[i] + } + + if fic.ParentField != nil { + fieldPath := fic.ParentField.Path() + return append(fieldPath, inputPath...) + + } + + return inputPath +} + +func NewFieldInputWithField(field string) *FieldInputContext { + return &FieldInputContext{Field: &field} +} + +func NewFieldInputWithIndex(index int) *FieldInputContext { + return &FieldInputContext{Index: &index} +} + +func WithFieldInputContext(ctx context.Context, fic *FieldInputContext) context.Context { + if fieldContext := GetFieldContext(ctx); fieldContext != nil { + fic.ParentField = fieldContext + } + if fieldInputContext := GetFieldInputContext(ctx); fieldInputContext != nil { + fic.ParentInput = fieldInputContext + } + + return context.WithValue(ctx, fieldInputCtx, fic) +} + +func GetFieldInputContext(ctx context.Context) *FieldInputContext { + if val, ok := ctx.Value(fieldInputCtx).(*FieldInputContext); ok { + return val + } + return nil +} diff --git a/graphql/context_field_input_test.go b/graphql/context_field_input_test.go new file mode 100644 index 00000000000..789ef2f7b88 --- /dev/null +++ b/graphql/context_field_input_test.go @@ -0,0 +1,15 @@ +package graphql + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestGetFieldInputContext(t *testing.T) { + require.Nil(t, GetFieldContext(context.Background())) + + rc := &FieldInputContext{} + require.Equal(t, rc, GetFieldInputContext(WithFieldInputContext(context.Background(), rc))) +} From 1aa20f25f5c8b3897e8ba47e4adb181a005ee60c Mon Sep 17 00:00:00 2001 From: Bogdan Dumitru Date: Fri, 20 Mar 2020 08:17:05 +0100 Subject: [PATCH 2/7] Add test to highlight usecase --- codegen/testserver/generated.go | 592 ++++++++++++++---- codegen/testserver/gqlgen.yml | 3 + codegen/testserver/models-gen.go | 8 + .../testserver/mutation_with_custom_scalar.go | 29 + .../mutation_with_custom_scalar.graphql | 13 + .../mutation_with_custom_scalar_test.go | 63 ++ codegen/testserver/resolver.go | 8 + codegen/testserver/stub.go | 12 + example/chat/generated.go | 27 +- example/config/generated.go | 20 +- example/dataloader/generated.go | 15 +- .../accounts/graph/generated/generated.go | 15 +- .../products/graph/generated/generated.go | 18 +- .../reviews/graph/generated/generated.go | 18 +- example/fileupload/generated.go | 29 +- example/scalars/generated.go | 93 ++- example/selection/generated.go | 9 +- example/starwars/generated/exec.go | 109 +++- example/todo/generated.go | 49 +- example/type-system-extension/generated.go | 33 +- integration/generated.go | 60 +- .../testdata/followschema/out/resolver.go | 3 +- .../testdata/singlefile/out/resolver.go | 9 +- 23 files changed, 1001 insertions(+), 234 deletions(-) create mode 100644 codegen/testserver/mutation_with_custom_scalar.go create mode 100644 codegen/testserver/mutation_with_custom_scalar.graphql create mode 100644 codegen/testserver/mutation_with_custom_scalar_test.go diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index f5393a48d40..5953c2e8a2c 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -19,6 +19,7 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -43,6 +44,7 @@ type ResolverRoot interface { Errors() ErrorsResolver ForcedResolver() ForcedResolverResolver ModelMethods() ModelMethodsResolver + Mutation() MutationResolver OverlappingFields() OverlappingFieldsResolver Panics() PanicsResolver Primitive() PrimitiveResolver @@ -209,6 +211,10 @@ type ComplexityRoot struct { WithContext func(childComplexity int) int } + Mutation struct { + UpdateSomething func(childComplexity int, input SpecialInput) int + } + ObjectDirectives struct { NullableText func(childComplexity int) int Text func(childComplexity int) int @@ -374,6 +380,9 @@ type ForcedResolverResolver interface { type ModelMethodsResolver interface { ResolverField(ctx context.Context, obj *ModelMethods) (bool, error) } +type MutationResolver interface { + UpdateSomething(ctx context.Context, input SpecialInput) (string, error) +} type OverlappingFieldsResolver interface { OldFoo(ctx context.Context, obj *OverlappingFields) (int, error) } @@ -843,6 +852,18 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.ModelMethods.WithContext(childComplexity), true + case "Mutation.updateSomething": + if e.complexity.Mutation.UpdateSomething == nil { + break + } + + args, err := ec.field_Mutation_updateSomething_args(context.TODO(), rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateSomething(childComplexity, args["input"].(SpecialInput)), true + case "ObjectDirectives.nullableText": if e.complexity.ObjectDirectives.NullableText == nil { break @@ -1636,6 +1657,20 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { var buf bytes.Buffer data.MarshalGQL(&buf) + return &graphql.Response{ + Data: buf.Bytes(), + } + } + case ast.Mutation: + return func(ctx context.Context) *graphql.Response { + if !first { + return nil + } + first = false + data := ec._Mutation(ctx, rc.Operation.SelectionSet) + var buf bytes.Buffer + data.MarshalGQL(&buf) + return &graphql.Response{ Data: buf.Bytes(), } @@ -1894,6 +1929,20 @@ input MapStringInterfaceInput @goModel(model: "map[string]interface{}") { input NestedMapInput { map: MapStringInterfaceInput } +`, BuiltIn: false}, + &ast.Source{Name: "mutation_with_custom_scalar.graphql", Input: `extend type Mutation { + updateSomething(input: SpecialInput!): String! +} + +scalar Email + +input SpecialInput { + nesting: NestedInput! +} + +input NestedInput { + field: Email! +} `, BuiltIn: false}, &ast.Source{Name: "nulls.graphql", Input: `extend type Query { errorBubble: Error @@ -2203,7 +2252,8 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["min"]; ok { - arg0, err = ec.unmarshalNInt2int(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("min")) + arg0, err = ec.unmarshalNInt2int(childCtx, tmp) if err != nil { return nil, err } @@ -2211,7 +2261,8 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str args["min"] = arg0 var arg1 *int if tmp, ok := rawArgs["max"]; ok { - arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -2219,7 +2270,8 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str args["max"] = arg1 var arg2 *string if tmp, ok := rawArgs["message"]; ok { - arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("message")) + arg2, err = ec.unmarshalOString2ᚖstring(childCtx, tmp) if err != nil { return nil, err } @@ -2233,7 +2285,8 @@ func (ec *executionContext) dir_logged_args(ctx context.Context, rawArgs map[str args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNUUID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNUUID2string(childCtx, tmp) if err != nil { return nil, err } @@ -2247,7 +2300,8 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["min"]; ok { - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("min")) + arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -2255,7 +2309,8 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri args["min"] = arg0 var arg1 *int if tmp, ok := rawArgs["max"]; ok { - arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -2264,12 +2319,28 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri return args, nil } +func (ec *executionContext) field_Mutation_updateSomething_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 SpecialInput + if tmp, ok := rawArgs["input"]; ok { + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSpecialInput(childCtx, tmp) + if err != nil { + return nil, err + } + } + args["input"] = arg0 + return args, nil +} + 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 := rawArgs["u"]; ok { - arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -2283,7 +2354,8 @@ func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Conte args := map[string]interface{}{} var arg0 []MarshalPanic if tmp, ok := rawArgs["u"]; ok { - arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -2297,7 +2369,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2311,7 +2384,8 @@ func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["arg"]; ok { - arg0, err = ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNDefaultScalarImplementation2string(childCtx, tmp) if err != nil { return nil, err } @@ -2325,7 +2399,8 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, r args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["arg"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { @@ -2345,7 +2420,7 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, r return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2364,7 +2439,8 @@ func (ec *executionContext) field_Query_directiveFieldDef_args(ctx context.Conte args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["ret"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("ret")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2378,7 +2454,8 @@ func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context. args := map[string]interface{}{} var arg0 *InputDirectives if tmp, ok := rawArgs["arg"]; ok { - arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(childCtx, tmp) if err != nil { return nil, err } @@ -2392,8 +2469,9 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont args := map[string]interface{}{} var arg0 InnerInput if tmp, ok := rawArgs["arg"]; ok { + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) directive0 := func(ctx context.Context) (interface{}, error) { - return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, tmp) + return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Custom == nil { @@ -2402,7 +2480,7 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont return ec.directives.Custom(ctx, rawArgs, directive0) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2421,7 +2499,8 @@ func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, args := map[string]interface{}{} var arg0 InputDirectives if tmp, ok := rawArgs["arg"]; ok { - arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(childCtx, tmp) if err != nil { return nil, err } @@ -2435,7 +2514,8 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["arg"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { @@ -2447,7 +2527,7 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2462,7 +2542,8 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co args["arg"] = arg0 var arg1 *int if tmp, ok := rawArgs["arg2"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg2")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { @@ -2474,7 +2555,7 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2489,7 +2570,8 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co args["arg2"] = arg1 var arg2 *string if tmp, ok := rawArgs["arg3"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg3")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { return nil, errors.New("directive toNull is not implemented") @@ -2497,7 +2579,7 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return ec.directives.ToNull(ctx, rawArgs, directive0) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2518,7 +2600,8 @@ func (ec *executionContext) field_Query_enumInInput_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 *InputWithEnumValue if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(childCtx, tmp) if err != nil { return nil, err } @@ -2532,7 +2615,8 @@ func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 FallbackToStringEncoding if tmp, ok := rawArgs["arg"]; ok { - arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(childCtx, tmp) if err != nil { return nil, err } @@ -2546,7 +2630,8 @@ func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, raw args := map[string]interface{}{} var arg0 []string if tmp, ok := rawArgs["arg"]; ok { - arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNString2ᚕstringᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -2560,7 +2645,8 @@ func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 map[string]interface{} if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalOChanges2map(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOChanges2map(childCtx, tmp) if err != nil { return nil, err } @@ -2574,7 +2660,8 @@ func (ec *executionContext) field_Query_mapNestedStringInterface_args(ctx contex args := map[string]interface{}{} var arg0 *NestedMapInput if tmp, ok := rawArgs["in"]; ok { - arg0, err = ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("in")) + arg0, err = ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(childCtx, tmp) if err != nil { return nil, err } @@ -2588,7 +2675,8 @@ func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Cont args := map[string]interface{}{} var arg0 map[string]interface{} if tmp, ok := rawArgs["in"]; ok { - arg0, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("in")) + arg0, err = ec.unmarshalOMapStringInterfaceInput2map(childCtx, tmp) if err != nil { return nil, err } @@ -2602,7 +2690,8 @@ func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, r args := map[string]interface{}{} var arg0 [][]*OuterInput if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(childCtx, tmp) if err != nil { return nil, err } @@ -2616,7 +2705,8 @@ func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["arg"]; ok { - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -2630,7 +2720,8 @@ func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 *RecursiveInputSlice if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(childCtx, tmp) if err != nil { return nil, err } @@ -2644,7 +2735,8 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNInt2int(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNInt2int(childCtx, tmp) if err != nil { return nil, err } @@ -2658,7 +2750,8 @@ func (ec *executionContext) field_Subscription_directiveArg_args(ctx context.Con args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["arg"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { @@ -2678,7 +2771,7 @@ func (ec *executionContext) field_Subscription_directiveArg_args(ctx context.Con return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2697,7 +2790,8 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["arg"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { @@ -2709,7 +2803,7 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2724,7 +2818,8 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con args["arg"] = arg0 var arg1 *int if tmp, ok := rawArgs["arg2"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg2")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { @@ -2736,7 +2831,7 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2751,7 +2846,8 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con args["arg2"] = arg1 var arg2 *string if tmp, ok := rawArgs["arg3"]; ok { - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, tmp) } + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg3")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(childCtx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { return nil, errors.New("directive toNull is not implemented") @@ -2759,7 +2855,7 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con return ec.directives.ToNull(ctx, rawArgs, directive0) } - tmp, err = directive1(ctx) + tmp, err = directive1(childCtx) if err != nil { return nil, err } @@ -2780,7 +2876,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["break"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("break")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2788,7 +2885,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["break"] = arg0 var arg1 string if tmp, ok := rawArgs["default"]; ok { - arg1, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("default")) + arg1, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2796,7 +2894,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["default"] = arg1 var arg2 string if tmp, ok := rawArgs["func"]; ok { - arg2, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("func")) + arg2, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2804,7 +2903,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["func"] = arg2 var arg3 string if tmp, ok := rawArgs["interface"]; ok { - arg3, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("interface")) + arg3, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2812,7 +2912,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["interface"] = arg3 var arg4 string if tmp, ok := rawArgs["select"]; ok { - arg4, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("select")) + arg4, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2820,7 +2921,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["select"] = arg4 var arg5 string if tmp, ok := rawArgs["case"]; ok { - arg5, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("case")) + arg5, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2828,7 +2930,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["case"] = arg5 var arg6 string if tmp, ok := rawArgs["defer"]; ok { - arg6, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("defer")) + arg6, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2836,7 +2939,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["defer"] = arg6 var arg7 string if tmp, ok := rawArgs["go"]; ok { - arg7, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("go")) + arg7, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2844,7 +2948,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["go"] = arg7 var arg8 string if tmp, ok := rawArgs["map"]; ok { - arg8, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) + arg8, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2852,7 +2957,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["map"] = arg8 var arg9 string if tmp, ok := rawArgs["struct"]; ok { - arg9, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("struct")) + arg9, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2860,7 +2966,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["struct"] = arg9 var arg10 string if tmp, ok := rawArgs["chan"]; ok { - arg10, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("chan")) + arg10, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2868,7 +2975,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["chan"] = arg10 var arg11 string if tmp, ok := rawArgs["else"]; ok { - arg11, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("else")) + arg11, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2876,7 +2984,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["else"] = arg11 var arg12 string if tmp, ok := rawArgs["goto"]; ok { - arg12, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("goto")) + arg12, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2884,7 +2993,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["goto"] = arg12 var arg13 string if tmp, ok := rawArgs["package"]; ok { - arg13, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("package")) + arg13, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2892,7 +3002,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["package"] = arg13 var arg14 string if tmp, ok := rawArgs["switch"]; ok { - arg14, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("switch")) + arg14, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2900,7 +3011,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["switch"] = arg14 var arg15 string if tmp, ok := rawArgs["const"]; ok { - arg15, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("const")) + arg15, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2908,7 +3020,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["const"] = arg15 var arg16 string if tmp, ok := rawArgs["fallthrough"]; ok { - arg16, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("fallthrough")) + arg16, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2916,7 +3029,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["fallthrough"] = arg16 var arg17 string if tmp, ok := rawArgs["if"]; ok { - arg17, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("if")) + arg17, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2924,7 +3038,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["if"] = arg17 var arg18 string if tmp, ok := rawArgs["range"]; ok { - arg18, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("range")) + arg18, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2932,7 +3047,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["range"] = arg18 var arg19 string if tmp, ok := rawArgs["type"]; ok { - arg19, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) + arg19, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2940,7 +3056,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["type"] = arg19 var arg20 string if tmp, ok := rawArgs["continue"]; ok { - arg20, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("continue")) + arg20, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2948,7 +3065,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["continue"] = arg20 var arg21 string if tmp, ok := rawArgs["for"]; ok { - arg21, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("for")) + arg21, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2956,7 +3074,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["for"] = arg21 var arg22 string if tmp, ok := rawArgs["import"]; ok { - arg22, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("import")) + arg22, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2964,7 +3083,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["import"] = arg22 var arg23 string if tmp, ok := rawArgs["return"]; ok { - arg23, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("return")) + arg23, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2972,7 +3092,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["return"] = arg23 var arg24 string if tmp, ok := rawArgs["var"]; ok { - arg24, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("var")) + arg24, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2980,7 +3101,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["var"] = arg24 var arg25 string if tmp, ok := rawArgs["_"]; ok { - arg25, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("_")) + arg25, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -2994,7 +3116,8 @@ func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context. args := map[string]interface{}{} var arg0 *ValidInput if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(childCtx, tmp) if err != nil { return nil, err } @@ -3008,7 +3131,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -3022,7 +3146,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -4692,6 +4817,44 @@ func (ec *executionContext) _ModelMethods_withContext(ctx context.Context, field return ec.marshalNBoolean2bool(ctx, field.Selections, res) } +func (ec *executionContext) _Mutation_updateSomething(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + fc := &graphql.FieldContext{ + Object: "Mutation", + Field: field, + Args: nil, + IsMethod: true, + } + + ctx = graphql.WithFieldContext(ctx, fc) + rawArgs := field.ArgumentMap(ec.Variables) + args, err := ec.field_Mutation_updateSomething_args(ctx, rawArgs) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + fc.Args = args + resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateSomething(rctx, args["input"].(SpecialInput)) + }) + + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field graphql.CollectedField, obj *ObjectDirectives) (ret graphql.Marshaler) { defer func() { if r := recover(); r != nil { @@ -9031,7 +9194,9 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o switch k { case "message": var err error - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("message")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, v) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { @@ -9047,7 +9212,7 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o return ec.directives.Length(ctx, obj, directive0, min, nil, message) } - tmp, err := directive1(ctx) + tmp, err := directive1(childCtx) if err != nil { return it, err } @@ -9070,7 +9235,9 @@ func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, obj in switch k { case "id": var err error - it.ID, err = ec.unmarshalNInt2int(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + it.ID, err = ec.unmarshalNInt2int(childCtx, v) if err != nil { return it, err } @@ -9088,7 +9255,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o switch k { case "text": var err error - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, v) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { @@ -9108,7 +9277,7 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o return ec.directives.Length(ctx, obj, directive0, min, max, message) } - tmp, err := directive1(ctx) + tmp, err := directive1(childCtx) if err != nil { return it, err } @@ -9119,7 +9288,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o } case "nullableText": var err error - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, v) } + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("nullableText")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(childCtx, v) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { return nil, errors.New("directive toNull is not implemented") @@ -9127,7 +9298,7 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o return ec.directives.ToNull(ctx, obj, directive0) } - tmp, err := directive1(ctx) + tmp, err := directive1(childCtx) if err != nil { return it, err } @@ -9140,20 +9311,26 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o } case "inner": var err error - it.Inner, err = ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("inner")) + it.Inner, err = ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(childCtx, v) if err != nil { return it, err } case "innerNullable": var err error - it.InnerNullable, err = ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("innerNullable")) + it.InnerNullable, err = ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(childCtx, v) if err != nil { return it, err } case "thirdParty": var err error + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("thirdParty")) directive0 := func(ctx context.Context) (interface{}, error) { - return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx, v) + return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(childCtx, v) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) @@ -9170,7 +9347,7 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o return ec.directives.Length(ctx, obj, directive0, min, max, nil) } - tmp, err := directive1(ctx) + tmp, err := directive1(childCtx) if err != nil { return it, err } @@ -9195,7 +9372,29 @@ func (ec *executionContext) unmarshalInputInputWithEnumValue(ctx context.Context switch k { case "enum": var err error - it.Enum, err = ec.unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("enum")) + it.Enum, err = ec.unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(childCtx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputNestedInput(ctx context.Context, obj interface{}) (NestedInput, error) { + var it NestedInput + var asMap = obj.(map[string]interface{}) + + for k, v := range asMap { + switch k { + case "field": + var err error + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("field")) + it.Field, err = ec.unmarshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(childCtx, v) if err != nil { return it, err } @@ -9213,7 +9412,9 @@ func (ec *executionContext) unmarshalInputNestedMapInput(ctx context.Context, ob switch k { case "map": var err error - it.Map, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) + it.Map, err = ec.unmarshalOMapStringInterfaceInput2map(childCtx, v) if err != nil { return it, err } @@ -9231,7 +9432,9 @@ func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, obj in switch k { case "inner": var err error - it.Inner, err = ec.unmarshalNInnerInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("inner")) + it.Inner, err = ec.unmarshalNInnerInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(childCtx, v) if err != nil { return it, err } @@ -9249,7 +9452,29 @@ func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Contex switch k { case "self": var err error - it.Self, err = ec.unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSliceᚄ(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("self")) + it.Self, err = ec.unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSliceᚄ(childCtx, v) + if err != nil { + return it, err + } + } + } + + return it, nil +} + +func (ec *executionContext) unmarshalInputSpecialInput(ctx context.Context, obj interface{}) (SpecialInput, error) { + var it SpecialInput + var asMap = obj.(map[string]interface{}) + + for k, v := range asMap { + switch k { + case "nesting": + var err error + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("nesting")) + it.Nesting, err = ec.unmarshalNNestedInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(childCtx, v) if err != nil { return it, err } @@ -9267,157 +9492,209 @@ func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, obj in switch k { case "break": var err error - it.Break, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("break")) + it.Break, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "default": var err error - it.Default, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("default")) + it.Default, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "func": var err error - it.Func, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("func")) + it.Func, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "interface": var err error - it.Interface, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("interface")) + it.Interface, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "select": var err error - it.Select, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("select")) + it.Select, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "case": var err error - it.Case, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("case")) + it.Case, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "defer": var err error - it.Defer, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("defer")) + it.Defer, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "go": var err error - it.Go, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("go")) + it.Go, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "map": var err error - it.Map, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) + it.Map, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "struct": var err error - it.Struct, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("struct")) + it.Struct, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "chan": var err error - it.Chan, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("chan")) + it.Chan, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "else": var err error - it.Else, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("else")) + it.Else, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "goto": var err error - it.Goto, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("goto")) + it.Goto, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "package": var err error - it.Package, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("package")) + it.Package, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "switch": var err error - it.Switch, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("switch")) + it.Switch, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "const": var err error - it.Const, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("const")) + it.Const, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "fallthrough": var err error - it.Fallthrough, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("fallthrough")) + it.Fallthrough, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "if": var err error - it.If, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("if")) + it.If, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "range": var err error - it.Range, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("range")) + it.Range, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "type": var err error - it.Type, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) + it.Type, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "continue": var err error - it.Continue, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("continue")) + it.Continue, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "for": var err error - it.For, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("for")) + it.For, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "import": var err error - it.Import, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("import")) + it.Import, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "return": var err error - it.Return, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("return")) + it.Return, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "var": var err error - it.Var, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("var")) + it.Var, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "_": var err error - it.Underscore, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("_")) + it.Underscore, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } @@ -10531,6 +10808,37 @@ func (ec *executionContext) _ModelMethods(ctx context.Context, sel ast.Selection return out } +var mutationImplementors = []string{"Mutation"} + +func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, mutationImplementors) + + ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ + Object: "Mutation", + }) + + out := graphql.NewFieldSet(fields) + var invalids uint32 + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("Mutation") + case "updateSomething": + out.Values[i] = ec._Mutation_updateSomething(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 +} + var objectDirectivesImplementors = []string{"ObjectDirectives"} func (ec *executionContext) _ObjectDirectives(ctx context.Context, sel ast.SelectionSet, obj *ObjectDirectives) graphql.Marshaler { @@ -12096,9 +12404,40 @@ func (ec *executionContext) marshalNDefaultScalarImplementation2string(ctx conte return res } +func (ec *executionContext) unmarshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(ctx context.Context, v interface{}) (Email, error) { + var res Email + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil +} + +func (ec *executionContext) marshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(ctx context.Context, sel ast.SelectionSet, v Email) graphql.Marshaler { + return v +} + func (ec *executionContext) unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(ctx context.Context, v interface{}) (EnumTest, error) { var res EnumTest - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(ctx context.Context, sel ast.SelectionSet, v EnumTest) graphql.Marshaler { @@ -12276,7 +12615,18 @@ func (ec *executionContext) marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx context.Context, v interface{}) (MarshalPanic, error) { var res MarshalPanic - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx context.Context, sel ast.SelectionSet, v MarshalPanic) graphql.Marshaler { @@ -12312,6 +12662,18 @@ func (ec *executionContext) marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋg return ret } +func (ec *executionContext) unmarshalNNestedInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx context.Context, v interface{}) (NestedInput, error) { + return ec.unmarshalInputNestedInput(ctx, v) +} + +func (ec *executionContext) unmarshalNNestedInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx context.Context, v interface{}) (*NestedInput, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalNNestedInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx, v) + return &res, err +} + func (ec *executionContext) marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNode(ctx context.Context, sel ast.SelectionSet, v Node) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -12418,6 +12780,10 @@ func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgen return ec._ShapeUnion(ctx, sel, v) } +func (ec *executionContext) unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSpecialInput(ctx context.Context, v interface{}) (SpecialInput, error) { + return ec.unmarshalInputSpecialInput(ctx, v) +} + func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { return graphql.UnmarshalString(v) } diff --git a/codegen/testserver/gqlgen.yml b/codegen/testserver/gqlgen.yml index ab0d95c4942..d9d4f0c5b17 100644 --- a/codegen/testserver/gqlgen.yml +++ b/codegen/testserver/gqlgen.yml @@ -14,3 +14,6 @@ autobind: - "github.com/99designs/gqlgen/codegen/testserver/introspection" - "github.com/99designs/gqlgen/codegen/testserver/invalid-packagename" +models: + Email: + model: "github.com/99designs/gqlgen/codegen/testserver.Email" diff --git a/codegen/testserver/models-gen.go b/codegen/testserver/models-gen.go index 29f360cfa6e..6e9885734f7 100644 --- a/codegen/testserver/models-gen.go +++ b/codegen/testserver/models-gen.go @@ -113,6 +113,10 @@ type Map struct { ID string `json:"id"` } +type NestedInput struct { + Field Email `json:"field"` +} + type NestedMapInput struct { Map map[string]interface{} `json:"map"` } @@ -137,6 +141,10 @@ type Slices struct { Test4 []string `json:"test4"` } +type SpecialInput struct { + Nesting *NestedInput `json:"nesting"` +} + type User struct { ID int `json:"id"` Friends []*User `json:"friends"` diff --git a/codegen/testserver/mutation_with_custom_scalar.go b/codegen/testserver/mutation_with_custom_scalar.go new file mode 100644 index 00000000000..c2de6a9049e --- /dev/null +++ b/codegen/testserver/mutation_with_custom_scalar.go @@ -0,0 +1,29 @@ +package testserver + +import ( + "encoding/json" + "fmt" + "io" + "regexp" +) + +var re = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") + +type Email string + +func (value *Email) UnmarshalGQL(v interface{}) error { + input, ok := v.(string) + if !ok { + return fmt.Errorf("email expects a string value") + } + if !re.MatchString(input) { + return fmt.Errorf("invalid email format") + } + *value = Email(input) + return nil +} + +func (value Email) MarshalGQL(w io.Writer) { + output, _ := json.Marshal(string(value)) + w.Write(output) +} diff --git a/codegen/testserver/mutation_with_custom_scalar.graphql b/codegen/testserver/mutation_with_custom_scalar.graphql new file mode 100644 index 00000000000..e9896ddb537 --- /dev/null +++ b/codegen/testserver/mutation_with_custom_scalar.graphql @@ -0,0 +1,13 @@ +extend type Mutation { + updateSomething(input: SpecialInput!): String! +} + +scalar Email + +input SpecialInput { + nesting: NestedInput! +} + +input NestedInput { + field: Email! +} diff --git a/codegen/testserver/mutation_with_custom_scalar_test.go b/codegen/testserver/mutation_with_custom_scalar_test.go new file mode 100644 index 00000000000..fab341b1a36 --- /dev/null +++ b/codegen/testserver/mutation_with_custom_scalar_test.go @@ -0,0 +1,63 @@ +package testserver + +import ( + "context" + "encoding/json" + "github.com/99designs/gqlgen/client" + "github.com/99designs/gqlgen/graphql/handler" + "github.com/stretchr/testify/require" + "testing" +) + +func TestErrorInsideMutationArgument(t *testing.T) { + resolvers := &Stub{} + resolvers.MutationResolver.UpdateSomething = func(_ context.Context, input SpecialInput) (s string, err error) { + return "Hello world", nil + } + + c := client.New(handler.NewDefaultServer(NewExecutableSchema(Config{Resolvers: resolvers}))) + + t.Run("mutation with correct input doesn't return error", func(t *testing.T) { + var resp map[string]interface{} + input := map[string]interface{}{ + "nesting": map[string]interface{}{ + "field": "email@example.com", + }, + } + err := c.Post( + `mutation TestMutation($input: SpecialInput!) { updateSomething(input: $input) }`, + &resp, + client.Var("input", input), + ) + require.Equal(t, resp["updateSomething"], "Hello world") + require.NoError(t, err) + }) + + t.Run("mutation with incorrect input returns full path", func(t *testing.T) { + var resp map[string]interface{} + input := map[string]interface{}{ + "nesting": map[string]interface{}{ + "field": "not-an-email", + }, + } + err := c.Post( + `mutation TestMutation($input: SpecialInput!) { updateSomething(input: $input) }`, + &resp, + client.Var("input", input), + ) + jsonErr, ok := err.(client.RawJsonError) + require.True(t, ok) + var errDetails []map[string]interface{} + err = json.Unmarshal(jsonErr.RawMessage, &errDetails) + require.NoError(t, err) + require.Len(t, errDetails, 1) + firstErr := errDetails[0] + path, ok := firstErr["path"].([]interface{}) + require.Equal(t, path, []interface{}{ + "updateSomething", + "input", + "nesting", + "field", + }) + }) +} diff --git a/codegen/testserver/resolver.go b/codegen/testserver/resolver.go index 6b9b02df2f7..28890d58905 100644 --- a/codegen/testserver/resolver.go +++ b/codegen/testserver/resolver.go @@ -43,6 +43,10 @@ func (r *modelMethodsResolver) ResolverField(ctx context.Context, obj *ModelMeth panic("not implemented") } +func (r *mutationResolver) UpdateSomething(ctx context.Context, input SpecialInput) (string, error) { + panic("not implemented") +} + func (r *overlappingFieldsResolver) OldFoo(ctx context.Context, obj *OverlappingFields) (int, error) { panic("not implemented") } @@ -319,6 +323,9 @@ func (r *Resolver) ForcedResolver() ForcedResolverResolver { return &forcedResol // ModelMethods returns ModelMethodsResolver implementation. func (r *Resolver) ModelMethods() ModelMethodsResolver { return &modelMethodsResolver{r} } +// Mutation returns MutationResolver implementation. +func (r *Resolver) Mutation() MutationResolver { return &mutationResolver{r} } + // OverlappingFields returns OverlappingFieldsResolver implementation. func (r *Resolver) OverlappingFields() OverlappingFieldsResolver { return &overlappingFieldsResolver{r} } @@ -344,6 +351,7 @@ type backedByInterfaceResolver struct{ *Resolver } type errorsResolver struct{ *Resolver } type forcedResolverResolver struct{ *Resolver } type modelMethodsResolver struct{ *Resolver } +type mutationResolver struct{ *Resolver } type overlappingFieldsResolver struct{ *Resolver } type panicsResolver struct{ *Resolver } type primitiveResolver struct{ *Resolver } diff --git a/codegen/testserver/stub.go b/codegen/testserver/stub.go index 6e4608287f9..9257fc0fcd7 100644 --- a/codegen/testserver/stub.go +++ b/codegen/testserver/stub.go @@ -26,6 +26,9 @@ type Stub struct { ModelMethodsResolver struct { ResolverField func(ctx context.Context, obj *ModelMethods) (bool, error) } + MutationResolver struct { + UpdateSomething func(ctx context.Context, input SpecialInput) (string, error) + } OverlappingFieldsResolver struct { OldFoo func(ctx context.Context, obj *OverlappingFields) (int, error) } @@ -120,6 +123,9 @@ func (r *Stub) ForcedResolver() ForcedResolverResolver { func (r *Stub) ModelMethods() ModelMethodsResolver { return &stubModelMethods{r} } +func (r *Stub) Mutation() MutationResolver { + return &stubMutation{r} +} func (r *Stub) OverlappingFields() OverlappingFieldsResolver { return &stubOverlappingFields{r} } @@ -178,6 +184,12 @@ func (r *stubModelMethods) ResolverField(ctx context.Context, obj *ModelMethods) return r.ModelMethodsResolver.ResolverField(ctx, obj) } +type stubMutation struct{ *Stub } + +func (r *stubMutation) UpdateSomething(ctx context.Context, input SpecialInput) (string, error) { + return r.MutationResolver.UpdateSomething(ctx, input) +} + type stubOverlappingFields struct{ *Stub } func (r *stubOverlappingFields) OldFoo(ctx context.Context, obj *OverlappingFields) (int, error) { diff --git a/example/chat/generated.go b/example/chat/generated.go index f8a2eb260f9..f930cc0bd44 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -296,7 +296,8 @@ func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[strin args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["username"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("username")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -310,7 +311,8 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["text"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -318,7 +320,8 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg args["text"] = arg0 var arg1 string if tmp, ok := rawArgs["username"]; ok { - arg1, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("username")) + arg1, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -326,7 +329,8 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg args["username"] = arg1 var arg2 string if tmp, ok := rawArgs["roomName"]; ok { - arg2, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("roomName")) + arg2, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -340,7 +344,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -354,7 +359,8 @@ func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -368,7 +374,8 @@ func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Con args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["roomName"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("roomName")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -382,7 +389,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -396,7 +404,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } diff --git a/example/config/generated.go b/example/config/generated.go index e2a8e3604f3..21228158833 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -264,7 +264,8 @@ func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, args := map[string]interface{}{} var arg0 NewTodo if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(childCtx, tmp) if err != nil { return nil, err } @@ -278,7 +279,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -292,7 +294,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -306,7 +309,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -1768,13 +1772,17 @@ func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, obj inter switch k { case "text": var err error - it.Text, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + it.Text, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "userId": var err error - it.UserID, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("userId")) + it.UserID, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index a42b79f08fe..cc13907e7ad 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -313,7 +313,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -327,7 +328,8 @@ func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []int if tmp, ok := rawArgs["customerIds"]; ok { - arg0, err = ec.unmarshalOInt2ᚕintᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("customerIds")) + arg0, err = ec.unmarshalOInt2ᚕintᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -341,7 +343,8 @@ func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 [][]int if tmp, ok := rawArgs["customerIds"]; ok { - arg0, err = ec.unmarshalOInt2ᚕᚕint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("customerIds")) + arg0, err = ec.unmarshalOInt2ᚕᚕint(childCtx, tmp) if err != nil { return nil, err } @@ -355,7 +358,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -369,7 +373,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } diff --git a/example/federation/accounts/graph/generated/generated.go b/example/federation/accounts/graph/generated/generated.go index 525a1aed6e4..3d91fd0ac6e 100644 --- a/example/federation/accounts/graph/generated/generated.go +++ b/example/federation/accounts/graph/generated/generated.go @@ -246,7 +246,8 @@ func (ec *executionContext) field_Entity_findUserByID_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -260,7 +261,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -274,7 +276,8 @@ func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []map[string]interface{} if tmp, ok := rawArgs["representations"]; ok { - arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -288,7 +291,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -302,7 +306,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } diff --git a/example/federation/products/graph/generated/generated.go b/example/federation/products/graph/generated/generated.go index 775b6c09fef..054aee218a5 100644 --- a/example/federation/products/graph/generated/generated.go +++ b/example/federation/products/graph/generated/generated.go @@ -260,7 +260,8 @@ func (ec *executionContext) field_Entity_findProductByUpc_args(ctx context.Conte args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["upc"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("upc")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -274,7 +275,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -288,7 +290,8 @@ func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []map[string]interface{} if tmp, ok := rawArgs["representations"]; ok { - arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -302,7 +305,8 @@ func (ec *executionContext) field_Query_topProducts_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["first"]; ok { - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -316,7 +320,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -330,7 +335,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } diff --git a/example/federation/reviews/graph/generated/generated.go b/example/federation/reviews/graph/generated/generated.go index 108d3d2822a..2097f308f5a 100644 --- a/example/federation/reviews/graph/generated/generated.go +++ b/example/federation/reviews/graph/generated/generated.go @@ -310,7 +310,8 @@ func (ec *executionContext) field_Entity_findProductByUpc_args(ctx context.Conte args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["upc"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("upc")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -324,7 +325,8 @@ func (ec *executionContext) field_Entity_findUserByID_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -338,7 +340,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -352,7 +355,8 @@ func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []map[string]interface{} if tmp, ok := rawArgs["representations"]; ok { - arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -366,7 +370,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -380,7 +385,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 4564bf52dbb..0d7f79e0712 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -277,7 +277,8 @@ func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx co args := map[string]interface{}{} var arg0 []*model.UploadFile if tmp, ok := rawArgs["req"]; ok { - arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFileᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("req")) + arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFileᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -291,7 +292,8 @@ func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Conte args := map[string]interface{}{} var arg0 []*graphql.Upload if tmp, ok := rawArgs["files"]; ok { - arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUploadᚄ(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("files")) + arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUploadᚄ(childCtx, tmp) if err != nil { return nil, err } @@ -305,7 +307,8 @@ func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx cont args := map[string]interface{}{} var arg0 model.UploadFile if tmp, ok := rawArgs["req"]; ok { - arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("req")) + arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(childCtx, tmp) if err != nil { return nil, err } @@ -319,7 +322,8 @@ func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context args := map[string]interface{}{} var arg0 graphql.Upload if tmp, ok := rawArgs["file"]; ok { - arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("file")) + arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(childCtx, tmp) if err != nil { return nil, err } @@ -333,7 +337,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -347,7 +352,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -361,7 +367,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -1844,13 +1851,17 @@ func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, obj in switch k { case "id": var err error - it.ID, err = ec.unmarshalNInt2int(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + it.ID, err = ec.unmarshalNInt2int(childCtx, v) if err != nil { return it, err } case "file": var err error - it.File, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("file")) + it.File, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(childCtx, v) if err != nil { return it, err } diff --git a/example/scalars/generated.go b/example/scalars/generated.go index c28fca3b7d3..be38290ada7 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -17,6 +17,7 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -284,7 +285,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -298,7 +300,8 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 *model.SearchArgs if tmp, ok := rawArgs["input"]; ok { - arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(childCtx, tmp) if err != nil { return nil, err } @@ -312,7 +315,8 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 external.ObjectID if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(childCtx, tmp) if err != nil { return nil, err } @@ -326,7 +330,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -340,7 +345,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -1896,19 +1902,25 @@ func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, obj in switch k { case "location": var err error - it.Location, err = ec.unmarshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("location")) + it.Location, err = ec.unmarshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(childCtx, v) if err != nil { return it, err } case "createdAfter": var err error - it.CreatedAfter, err = ec.unmarshalOTimestamp2ᚖtimeᚐTime(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("createdAfter")) + it.CreatedAfter, err = ec.unmarshalOTimestamp2ᚖtimeᚐTime(childCtx, v) if err != nil { return it, err } case "isBanned": var err error - it.IsBanned, err = ec.unmarshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("isBanned")) + it.IsBanned, err = ec.unmarshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(childCtx, v) if err != nil { return it, err } @@ -2328,7 +2340,18 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o func (ec *executionContext) unmarshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, v interface{}) (model.Banned, error) { var res model.Banned - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, sel ast.SelectionSet, v model.Banned) graphql.Marshaler { @@ -2365,7 +2388,18 @@ func (ec *executionContext) marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexamp func (ec *executionContext) unmarshalNPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, v interface{}) (model.Point, error) { var res model.Point - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v model.Point) graphql.Marshaler { @@ -2687,7 +2721,18 @@ func (ec *executionContext) marshalOAddress2githubᚗcomᚋ99designsᚋgqlgenᚋ func (ec *executionContext) unmarshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, v interface{}) (model.Banned, error) { var res model.Banned - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, sel ast.SelectionSet, v model.Banned) graphql.Marshaler { @@ -2719,7 +2764,18 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast func (ec *executionContext) unmarshalOPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, v interface{}) (model.Point, error) { var res model.Point - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalOPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v model.Point) graphql.Marshaler { @@ -2778,7 +2834,18 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as func (ec *executionContext) unmarshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx context.Context, v interface{}) (model.Tier, error) { var res model.Tier - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx context.Context, sel ast.SelectionSet, v model.Tier) graphql.Marshaler { diff --git a/example/selection/generated.go b/example/selection/generated.go index d6d7733f15d..13ae4cf8bee 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -230,7 +230,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -244,7 +245,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -258,7 +260,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index e5757e6f31a..55f52a63115 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -17,6 +17,7 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -694,7 +695,8 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["first"]; ok { - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -702,7 +704,8 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte args["first"] = arg0 var arg1 *string if tmp, ok := rawArgs["after"]; ok { - arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("after")) + arg1, err = ec.unmarshalOID2ᚖstring(childCtx, tmp) if err != nil { return nil, err } @@ -716,7 +719,8 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["first"]; ok { - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -724,7 +728,8 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte args["first"] = arg0 var arg1 *string if tmp, ok := rawArgs["after"]; ok { - arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("after")) + arg1, err = ec.unmarshalOID2ᚖstring(childCtx, tmp) if err != nil { return nil, err } @@ -738,7 +743,8 @@ func (ec *executionContext) field_Human_height_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 models.LengthUnit if tmp, ok := rawArgs["unit"]; ok { - arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("unit")) + arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(childCtx, tmp) if err != nil { return nil, err } @@ -752,7 +758,8 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context args := map[string]interface{}{} var arg0 models.Episode if tmp, ok := rawArgs["episode"]; ok { - arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) + arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(childCtx, tmp) if err != nil { return nil, err } @@ -760,7 +767,8 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context args["episode"] = arg0 var arg1 models.Review if tmp, ok := rawArgs["review"]; ok { - arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("review")) + arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(childCtx, tmp) if err != nil { return nil, err } @@ -774,7 +782,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -788,7 +797,8 @@ func (ec *executionContext) field_Query_character_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -802,7 +812,8 @@ func (ec *executionContext) field_Query_droid_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -816,7 +827,8 @@ func (ec *executionContext) field_Query_hero_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 *models.Episode if tmp, ok := rawArgs["episode"]; ok { - arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) + arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(childCtx, tmp) if err != nil { return nil, err } @@ -830,7 +842,8 @@ func (ec *executionContext) field_Query_human_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -844,7 +857,8 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 models.Episode if tmp, ok := rawArgs["episode"]; ok { - arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) + arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(childCtx, tmp) if err != nil { return nil, err } @@ -852,7 +866,8 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArg args["episode"] = arg0 var arg1 *time.Time if tmp, ok := rawArgs["since"]; ok { - arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("since")) + arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(childCtx, tmp) if err != nil { return nil, err } @@ -866,7 +881,8 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["text"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -880,7 +896,8 @@ func (ec *executionContext) field_Query_starship_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -894,7 +911,8 @@ func (ec *executionContext) field_Starship_length_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 *models.LengthUnit if tmp, ok := rawArgs["unit"]; ok { - arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("unit")) + arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(childCtx, tmp) if err != nil { return nil, err } @@ -908,7 +926,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -922,7 +941,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -3399,19 +3419,25 @@ func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, obj i switch k { case "stars": var err error - it.Stars, err = ec.unmarshalNInt2int(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("stars")) + it.Stars, err = ec.unmarshalNInt2int(childCtx, v) if err != nil { return it, err } case "commentary": var err error - it.Commentary, err = ec.unmarshalOString2ᚖstring(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("commentary")) + it.Commentary, err = ec.unmarshalOString2ᚖstring(childCtx, v) if err != nil { return it, err } case "time": var err error - it.Time, err = ec.unmarshalOTime2timeᚐTime(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("time")) + it.Time, err = ec.unmarshalOTime2timeᚐTime(childCtx, v) if err != nil { return it, err } @@ -4240,7 +4266,18 @@ func (ec *executionContext) marshalNCharacter2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, v interface{}) (models.Episode, error) { var res models.Episode - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, sel ast.SelectionSet, v models.Episode) graphql.Marshaler { @@ -4875,7 +4912,18 @@ func (ec *executionContext) marshalODroid2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalOEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, v interface{}) (models.Episode, error) { var res models.Episode - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalOEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, sel ast.SelectionSet, v models.Episode) graphql.Marshaler { @@ -5004,7 +5052,18 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele func (ec *executionContext) unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx context.Context, v interface{}) (models.LengthUnit, error) { var res models.LengthUnit - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx context.Context, sel ast.SelectionSet, v models.LengthUnit) graphql.Marshaler { diff --git a/example/todo/generated.go b/example/todo/generated.go index ed03217ac23..0225172cd9d 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -15,6 +15,7 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -280,7 +281,8 @@ func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[st args := map[string]interface{}{} var arg0 Role if tmp, ok := rawArgs["role"]; ok { - arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("role")) + arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(childCtx, tmp) if err != nil { return nil, err } @@ -294,7 +296,8 @@ func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[strin args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2int(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2int(childCtx, tmp) if err != nil { return nil, err } @@ -308,7 +311,8 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context args := map[string]interface{}{} var arg0 TodoInput if tmp, ok := rawArgs["todo"]; ok { - arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("todo")) + arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(childCtx, tmp) if err != nil { return nil, err } @@ -322,7 +326,8 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2int(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2int(childCtx, tmp) if err != nil { return nil, err } @@ -330,7 +335,8 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context args["id"] = arg0 var arg1 map[string]interface{} if tmp, ok := rawArgs["changes"]; ok { - arg1, err = ec.unmarshalNMap2map(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("changes")) + arg1, err = ec.unmarshalNMap2map(childCtx, tmp) if err != nil { return nil, err } @@ -344,7 +350,8 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -358,7 +365,8 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2int(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2int(childCtx, tmp) if err != nil { return nil, err } @@ -372,7 +380,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -386,7 +395,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -1811,13 +1821,17 @@ func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj int switch k { case "text": var err error - it.Text, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + it.Text, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "done": var err error - it.Done, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("done")) + it.Done, err = ec.unmarshalOBoolean2ᚖbool(childCtx, v) if err != nil { return it, err } @@ -2269,7 +2283,18 @@ func (ec *executionContext) marshalNMap2map(ctx context.Context, sel ast.Selecti func (ec *executionContext) unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx context.Context, v interface{}) (Role, error) { var res Role - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx context.Context, sel ast.SelectionSet, v Role) graphql.Marshaler { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 29b423d813c..e39b31b71d7 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -15,6 +15,7 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -300,7 +301,8 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context args := map[string]interface{}{} var arg0 TodoInput if tmp, ok := rawArgs["todo"]; ok { - arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("todo")) + arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(childCtx, tmp) if err != nil { return nil, err } @@ -314,7 +316,8 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -328,7 +331,8 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - arg0, err = ec.unmarshalNID2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(childCtx, tmp) if err != nil { return nil, err } @@ -342,7 +346,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -356,7 +361,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -1774,7 +1780,9 @@ func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj int switch k { case "text": var err error - it.Text, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + it.Text, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } @@ -2227,7 +2235,18 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec func (ec *executionContext) unmarshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx context.Context, v interface{}) (State, error) { var res State - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx context.Context, sel ast.SelectionSet, v State) graphql.Marshaler { diff --git a/integration/generated.go b/integration/generated.go index d5c3d89853f..bc62636e861 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -16,6 +16,7 @@ import ( "github.com/99designs/gqlgen/integration/remote_api" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -316,7 +317,8 @@ func (ec *executionContext) dir_magic_args(ctx context.Context, rawArgs map[stri args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["kind"]; ok { - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("kind")) + arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) if err != nil { return nil, err } @@ -330,7 +332,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - arg0, err = ec.unmarshalNString2string(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(childCtx, tmp) if err != nil { return nil, err } @@ -344,7 +347,8 @@ func (ec *executionContext) field_Query_complexity_args(ctx context.Context, raw args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["value"]; ok { - arg0, err = ec.unmarshalNInt2int(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("value")) + arg0, err = ec.unmarshalNInt2int(childCtx, tmp) if err != nil { return nil, err } @@ -358,7 +362,8 @@ func (ec *executionContext) field_Query_date_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 models.DateFilter if tmp, ok := rawArgs["filter"]; ok { - arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("filter")) + arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(childCtx, tmp) if err != nil { return nil, err } @@ -372,7 +377,8 @@ func (ec *executionContext) field_Query_error_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 *models.ErrorType if tmp, ok := rawArgs["type"]; ok { - arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) + arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(childCtx, tmp) if err != nil { return nil, err } @@ -386,7 +392,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -400,7 +407,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) if err != nil { return nil, err } @@ -1973,19 +1981,25 @@ func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, obj in switch k { case "value": var err error - it.Value, err = ec.unmarshalNString2string(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("value")) + it.Value, err = ec.unmarshalNString2string(childCtx, v) if err != nil { return it, err } case "timezone": var err error - it.Timezone, err = ec.unmarshalOString2ᚖstring(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("timezone")) + it.Timezone, err = ec.unmarshalOString2ᚖstring(childCtx, v) if err != nil { return it, err } case "op": var err error - it.Op, err = ec.unmarshalODATE_FILTER_OP2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx, v) + + childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("op")) + it.Op, err = ec.unmarshalODATE_FILTER_OP2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(childCtx, v) if err != nil { return it, err } @@ -2854,7 +2868,18 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast func (ec *executionContext) unmarshalODATE_FILTER_OP2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx context.Context, v interface{}) (models.DateFilterOp, error) { var res models.DateFilterOp - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalODATE_FILTER_OP2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx context.Context, sel ast.SelectionSet, v models.DateFilterOp) graphql.Marshaler { @@ -2929,7 +2954,18 @@ func (ec *executionContext) marshalOElement2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalOErrorType2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx context.Context, v interface{}) (models.ErrorType, error) { var res models.ErrorType - return res, res.UnmarshalGQL(v) + err := res.UnmarshalGQL(v) + if err != nil { + fic := graphql.GetFieldInputContext(ctx) + path := fic.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + gerr.Path = path + return res, gerr + } else { + return res, gqlerror.WrapPath(path, err) + } + } + return res, nil } func (ec *executionContext) marshalOErrorType2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx context.Context, sel ast.SelectionSet, v models.ErrorType) graphql.Marshaler { diff --git a/plugin/resolvergen/testdata/followschema/out/resolver.go b/plugin/resolvergen/testdata/followschema/out/resolver.go index 61296288110..fbe00ecff89 100644 --- a/plugin/resolvergen/testdata/followschema/out/resolver.go +++ b/plugin/resolvergen/testdata/followschema/out/resolver.go @@ -1,6 +1,7 @@ +package customresolver + // This file will not be regenerated automatically. // // It serves as dependency injection for your app, add any dependencies you require here. -package customresolver type CustomResolverType struct{} diff --git a/plugin/resolvergen/testdata/singlefile/out/resolver.go b/plugin/resolvergen/testdata/singlefile/out/resolver.go index 99a46892ae4..54d778636ae 100644 --- a/plugin/resolvergen/testdata/singlefile/out/resolver.go +++ b/plugin/resolvergen/testdata/singlefile/out/resolver.go @@ -1,6 +1,7 @@ -// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES. package customresolver +// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES. + import ( "context" ) @@ -10,11 +11,15 @@ type CustomResolverType struct{} func (r *queryCustomResolverType) Resolver(ctx context.Context) (*Resolver, error) { panic("not implemented") } + func (r *resolverCustomResolverType) Name(ctx context.Context, obj *Resolver) (string, error) { panic("not implemented") } -func (r *CustomResolverType) Query() QueryResolver { return &queryCustomResolverType{r} } +// Query returns QueryResolver implementation. +func (r *CustomResolverType) Query() QueryResolver { return &queryCustomResolverType{r} } + +// Resolver returns ResolverResolver implementation. func (r *CustomResolverType) Resolver() ResolverResolver { return &resolverCustomResolverType{r} } type queryCustomResolverType struct{ *CustomResolverType } From 61fa9903fa26c97a4fabbf3200e22c3d25ffcbc6 Mon Sep 17 00:00:00 2001 From: Bogdan Dumitru Date: Fri, 20 Mar 2020 08:31:02 +0100 Subject: [PATCH 3/7] Add documentation for scalad error handling --- codegen/generated!.gotpl | 1 - codegen/testserver/directive_test.go | 6 +- codegen/testserver/generated.go | 219 +++++++++--------- .../mutation_with_custom_scalar_test.go | 16 +- codegen/type.gotpl | 27 +-- docs/content/reference/scalars.md | 54 +++++ graphql/context_field_input.go | 18 ++ 7 files changed, 201 insertions(+), 140 deletions(-) diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index ed68c25adb8..03be286e1e1 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -10,7 +10,6 @@ {{ reserveImport "github.com/vektah/gqlparser/v2" }} {{ reserveImport "github.com/vektah/gqlparser/v2/ast" }} -{{ reserveImport "github.com/vektah/gqlparser/v2/gqlerror" }} {{ reserveImport "github.com/99designs/gqlgen/graphql" }} {{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }} diff --git a/codegen/testserver/directive_test.go b/codegen/testserver/directive_test.go index c201b255726..9175e18a40c 100644 --- a/codegen/testserver/directive_test.go +++ b/codegen/testserver/directive_test.go @@ -301,7 +301,7 @@ func TestDirectives(t *testing.T) { err := c.Post(`query { directiveInputNullable(arg: {text:"invalid text",inner:{message:"123"}}) }`, &resp) - require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable"]}]`) + require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable","arg"]}]`) require.Nil(t, resp.DirectiveInputNullable) }) t.Run("when function errors on inner directives", func(t *testing.T) { @@ -311,7 +311,7 @@ func TestDirectives(t *testing.T) { err := c.Post(`query { directiveInputNullable(arg: {text:"2",inner:{message:""}}) }`, &resp) - require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable"]}]`) + require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable","arg","inner"]}]`) require.Nil(t, resp.DirectiveInputNullable) }) t.Run("when function errors on nullable inner directives", func(t *testing.T) { @@ -321,7 +321,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":"not valid","path":["directiveInputNullable"]}]`) + require.EqualError(t, err, `[{"message":"not valid","path":["directiveInputNullable","arg","innerNullable"]}]`) 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 5953c2e8a2c..933f4c5a8cf 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -19,7 +19,6 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -12349,7 +12348,8 @@ func (ec *executionContext) _iIt(ctx context.Context, sel ast.SelectionSet, obj // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -12363,7 +12363,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNBytes2ᚕbyte(ctx context.Context, v interface{}) ([]byte, error) { - return UnmarshalBytes(v) + res, err := UnmarshalBytes(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBytes2ᚕbyte(ctx context.Context, sel ast.SelectionSet, v []byte) graphql.Marshaler { @@ -12391,7 +12392,8 @@ func (ec *executionContext) marshalNCheckIssue8962ᚖgithubᚗcomᚋ99designsᚋ } func (ec *executionContext) unmarshalNDefaultScalarImplementation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNDefaultScalarImplementation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -12407,17 +12409,7 @@ func (ec *executionContext) marshalNDefaultScalarImplementation2string(ctx conte func (ec *executionContext) unmarshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(ctx context.Context, v interface{}) (Email, error) { var res Email err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(ctx context.Context, sel ast.SelectionSet, v Email) graphql.Marshaler { @@ -12427,17 +12419,7 @@ func (ec *executionContext) marshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋco func (ec *executionContext) unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(ctx context.Context, v interface{}) (EnumTest, error) { var res EnumTest err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(ctx context.Context, sel ast.SelectionSet, v EnumTest) graphql.Marshaler { @@ -12460,7 +12442,7 @@ func (ec *executionContext) marshalNError2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx context.Context, v interface{}) (FallbackToStringEncoding, error) { tmp, err := graphql.UnmarshalString(v) - return FallbackToStringEncoding(tmp), err + return FallbackToStringEncoding(tmp), graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx context.Context, sel ast.SelectionSet, v FallbackToStringEncoding) graphql.Marshaler { @@ -12474,7 +12456,8 @@ func (ec *executionContext) marshalNFallbackToStringEncoding2githubᚗcomᚋ99de } func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalIntID(v) + res, err := graphql.UnmarshalIntID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -12488,7 +12471,8 @@ func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.Selectio } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -12502,7 +12486,8 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec } func (ec *executionContext) unmarshalNInnerDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx context.Context, v interface{}) (InnerDirectives, error) { - return ec.unmarshalInputInnerDirectives(ctx, v) + res, err := ec.unmarshalInputInnerDirectives(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx context.Context, v interface{}) (*InnerDirectives, error) { @@ -12510,11 +12495,12 @@ func (ec *executionContext) unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99design return nil, nil } res, err := ec.unmarshalNInnerDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx context.Context, v interface{}) (InnerInput, error) { - return ec.unmarshalInputInnerInput(ctx, v) + res, err := ec.unmarshalInputInnerInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNInnerInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx context.Context, v interface{}) (*InnerInput, error) { @@ -12522,7 +12508,7 @@ func (ec *executionContext) unmarshalNInnerInput2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInnerObject2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerObject(ctx context.Context, sel ast.SelectionSet, v InnerObject) graphql.Marshaler { @@ -12540,11 +12526,13 @@ func (ec *executionContext) marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx context.Context, v interface{}) (InputDirectives, error) { - return ec.unmarshalInputInputDirectives(ctx, v) + res, err := ec.unmarshalInputInputDirectives(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -12558,7 +12546,8 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti } func (ec *executionContext) unmarshalNInt2int32(ctx context.Context, v interface{}) (int32, error) { - return graphql.UnmarshalInt32(v) + res, err := graphql.UnmarshalInt32(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int32(ctx context.Context, sel ast.SelectionSet, v int32) graphql.Marshaler { @@ -12572,7 +12561,8 @@ func (ec *executionContext) marshalNInt2int32(ctx context.Context, sel ast.Selec } func (ec *executionContext) unmarshalNInt2int64(ctx context.Context, v interface{}) (int64, error) { - return graphql.UnmarshalInt64(v) + res, err := graphql.UnmarshalInt64(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int64(ctx context.Context, sel ast.SelectionSet, v int64) graphql.Marshaler { @@ -12616,17 +12606,7 @@ func (ec *executionContext) marshalNLoopB2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx context.Context, v interface{}) (MarshalPanic, error) { var res MarshalPanic err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx context.Context, sel ast.SelectionSet, v MarshalPanic) graphql.Marshaler { @@ -12645,9 +12625,10 @@ func (ec *executionContext) unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designs var err error res := make([]MarshalPanic, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -12663,7 +12644,8 @@ func (ec *executionContext) marshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋg } func (ec *executionContext) unmarshalNNestedInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx context.Context, v interface{}) (NestedInput, error) { - return ec.unmarshalInputNestedInput(ctx, v) + res, err := ec.unmarshalInputNestedInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNNestedInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx context.Context, v interface{}) (*NestedInput, error) { @@ -12671,7 +12653,7 @@ func (ec *executionContext) unmarshalNNestedInput2ᚖgithubᚗcomᚋ99designsᚋ return nil, nil } res, err := ec.unmarshalNNestedInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNode(ctx context.Context, sel ast.SelectionSet, v Node) graphql.Marshaler { @@ -12767,7 +12749,8 @@ func (ec *executionContext) marshalNPrimitiveString2ᚕgithubᚗcomᚋ99designs } func (ec *executionContext) unmarshalNRecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx context.Context, v interface{}) (RecursiveInputSlice, error) { - return ec.unmarshalInputRecursiveInputSlice(ctx, v) + res, err := ec.unmarshalInputRecursiveInputSlice(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShapeUnion(ctx context.Context, sel ast.SelectionSet, v ShapeUnion) graphql.Marshaler { @@ -12781,11 +12764,13 @@ func (ec *executionContext) marshalNShapeUnion2githubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSpecialInput(ctx context.Context, v interface{}) (SpecialInput, error) { - return ec.unmarshalInputSpecialInput(ctx, v) + res, err := ec.unmarshalInputSpecialInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -12810,9 +12795,10 @@ func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -12839,9 +12825,10 @@ func (ec *executionContext) unmarshalNString2ᚕᚖstring(ctx context.Context, v var err error res := make([]*string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOString2ᚖstring(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -12861,7 +12848,7 @@ func (ec *executionContext) unmarshalNString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalNString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { @@ -12875,7 +12862,8 @@ func (ec *executionContext) marshalNString2ᚖstring(ctx context.Context, sel as } func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return graphql.UnmarshalTime(v) + res, err := graphql.UnmarshalTime(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -12889,7 +12877,8 @@ func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel as } func (ec *executionContext) unmarshalNUUID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNUUID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -12955,7 +12944,7 @@ func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ 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 + return WrappedScalar(tmp), graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNWrappedScalar2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐWrappedScalar(ctx context.Context, sel ast.SelectionSet, v WrappedScalar) graphql.Marshaler { @@ -13024,7 +13013,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -13049,9 +13039,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -13195,7 +13186,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -13234,7 +13226,8 @@ func (ec *executionContext) marshalOBackedByInterface2githubᚗcomᚋ99designs } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -13246,7 +13239,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -13366,7 +13359,8 @@ func (ec *executionContext) marshalOCircle2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalODefaultScalarImplementation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalODefaultScalarImplementation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -13378,7 +13372,7 @@ func (ec *executionContext) unmarshalODefaultScalarImplementation2ᚖstring(ctx return nil, nil } res, err := ec.unmarshalODefaultScalarImplementation2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalODefaultScalarImplementation2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { @@ -13444,7 +13438,8 @@ func (ec *executionContext) marshalOErrors2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOFloat2float64(ctx context.Context, v interface{}) (float64, error) { - return graphql.UnmarshalFloat(v) + res, err := graphql.UnmarshalFloat(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { @@ -13452,7 +13447,8 @@ func (ec *executionContext) marshalOFloat2float64(ctx context.Context, sel ast.S } func (ec *executionContext) unmarshalOInnerDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx context.Context, v interface{}) (InnerDirectives, error) { - return ec.unmarshalInputInnerDirectives(ctx, v) + res, err := ec.unmarshalInputInnerDirectives(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx context.Context, v interface{}) (*InnerDirectives, error) { @@ -13460,11 +13456,12 @@ func (ec *executionContext) unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99design return nil, nil } res, err := ec.unmarshalOInnerDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx context.Context, v interface{}) (InputDirectives, error) { - return ec.unmarshalInputInputDirectives(ctx, v) + res, err := ec.unmarshalInputInputDirectives(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx context.Context, v interface{}) (*InputDirectives, error) { @@ -13472,11 +13469,12 @@ func (ec *executionContext) unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99design return nil, nil } res, err := ec.unmarshalOInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOInputWithEnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(ctx context.Context, v interface{}) (InputWithEnumValue, error) { - return ec.unmarshalInputInputWithEnumValue(ctx, v) + res, err := ec.unmarshalInputInputWithEnumValue(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(ctx context.Context, v interface{}) (*InputWithEnumValue, error) { @@ -13484,11 +13482,12 @@ func (ec *executionContext) unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99des return nil, nil } res, err := ec.unmarshalOInputWithEnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -13500,7 +13499,7 @@ func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interfac return nil, nil } res, err := ec.unmarshalOInt2int(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { @@ -13558,7 +13557,8 @@ func (ec *executionContext) marshalOModelMethods2ᚖgithubᚗcomᚋ99designsᚋg } func (ec *executionContext) unmarshalONestedMapInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(ctx context.Context, v interface{}) (NestedMapInput, error) { - return ec.unmarshalInputNestedMapInput(ctx, v) + res, err := ec.unmarshalInputNestedMapInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(ctx context.Context, v interface{}) (*NestedMapInput, error) { @@ -13566,7 +13566,7 @@ func (ec *executionContext) unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designs return nil, nil } res, err := ec.unmarshalONestedMapInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOObjectDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐObjectDirectives(ctx context.Context, sel ast.SelectionSet, v ObjectDirectives) graphql.Marshaler { @@ -13592,7 +13592,8 @@ func (ec *executionContext) marshalOObjectDirectivesWithCustomGoModel2ᚖgithub } func (ec *executionContext) unmarshalOOuterInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx context.Context, v interface{}) (OuterInput, error) { - return ec.unmarshalInputOuterInput(ctx, v) + res, err := ec.unmarshalInputOuterInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx context.Context, v interface{}) ([][]*OuterInput, error) { @@ -13607,9 +13608,10 @@ func (ec *executionContext) unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99desig var err error res := make([][]*OuterInput, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalOOuterInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOOuterInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -13627,9 +13629,10 @@ func (ec *executionContext) unmarshalOOuterInput2ᚕᚖgithubᚗcomᚋ99designs var err error res := make([]*OuterInput, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalOOuterInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOOuterInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -13640,7 +13643,7 @@ func (ec *executionContext) unmarshalOOuterInput2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalOOuterInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOOuterObject2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterObject(ctx context.Context, sel ast.SelectionSet, v OuterObject) graphql.Marshaler { @@ -13757,7 +13760,8 @@ func (ec *executionContext) marshalOPanics2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalORecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx context.Context, v interface{}) (RecursiveInputSlice, error) { - return ec.unmarshalInputRecursiveInputSlice(ctx, v) + res, err := ec.unmarshalInputRecursiveInputSlice(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSliceᚄ(ctx context.Context, v interface{}) ([]RecursiveInputSlice, error) { @@ -13772,9 +13776,10 @@ func (ec *executionContext) unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99de var err error res := make([]RecursiveInputSlice, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNRecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNRecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -13785,7 +13790,7 @@ func (ec *executionContext) unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99de return nil, nil } res, err := ec.unmarshalORecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOShape2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐShape(ctx context.Context, sel ast.SelectionSet, v Shape) graphql.Marshaler { @@ -13847,7 +13852,8 @@ func (ec *executionContext) marshalOSlices2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -13866,9 +13872,10 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -13898,9 +13905,10 @@ func (ec *executionContext) unmarshalOString2ᚕᚖstring(ctx context.Context, v var err error res := make([]*string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOString2ᚖstring(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -13923,7 +13931,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { @@ -13941,7 +13949,8 @@ func (ec *executionContext) marshalOTestUnion2githubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOThirdParty2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx context.Context, v interface{}) (ThirdParty, error) { - return UnmarshalThirdParty(v) + res, err := UnmarshalThirdParty(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOThirdParty2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx context.Context, sel ast.SelectionSet, v ThirdParty) graphql.Marshaler { @@ -13953,7 +13962,7 @@ func (ec *executionContext) unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalOThirdParty2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx context.Context, sel ast.SelectionSet, v *ThirdParty) graphql.Marshaler { @@ -13964,7 +13973,8 @@ func (ec *executionContext) marshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgql } func (ec *executionContext) unmarshalOTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return graphql.UnmarshalTime(v) + res, err := graphql.UnmarshalTime(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -13976,7 +13986,7 @@ func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v return nil, nil } res, err := ec.unmarshalOTime2timeᚐTime(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { @@ -13987,7 +13997,8 @@ func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel } func (ec *executionContext) unmarshalOValidInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx context.Context, v interface{}) (ValidInput, error) { - return ec.unmarshalInputValidInput(ctx, v) + res, err := ec.unmarshalInputValidInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx context.Context, v interface{}) (*ValidInput, error) { @@ -13995,7 +14006,7 @@ func (ec *executionContext) unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalOValidInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOValidType2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidType(ctx context.Context, sel ast.SelectionSet, v ValidType) graphql.Marshaler { diff --git a/codegen/testserver/mutation_with_custom_scalar_test.go b/codegen/testserver/mutation_with_custom_scalar_test.go index fab341b1a36..fbad2189590 100644 --- a/codegen/testserver/mutation_with_custom_scalar_test.go +++ b/codegen/testserver/mutation_with_custom_scalar_test.go @@ -2,7 +2,6 @@ package testserver import ( "context" - "encoding/json" "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" @@ -45,19 +44,6 @@ func TestErrorInsideMutationArgument(t *testing.T) { &resp, client.Var("input", input), ) - jsonErr, ok := err.(client.RawJsonError) - require.True(t, ok) - var errDetails []map[string]interface{} - err = json.Unmarshal(jsonErr.RawMessage, &errDetails) - require.NoError(t, err) - require.Len(t, errDetails, 1) - firstErr := errDetails[0] - path, ok := firstErr["path"].([]interface{}) - require.Equal(t, path, []interface{}{ - "updateSomething", - "input", - "nesting", - "field", - }) + require.EqualError(t, err, `[{"message":"invalid email format","path":["updateSomething","input","nesting","field"]}]`) }) } diff --git a/codegen/type.gotpl b/codegen/type.gotpl index 06a285e3f57..b30154ee243 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -6,7 +6,7 @@ {{- end }} {{- if $type.IsPtr }} res, err := ec.{{ $type.Elem.UnmarshalFunc }}(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) {{- else if $type.IsSlice }} var vSlice []interface{} if v != nil { @@ -19,9 +19,10 @@ var err error res := make([]{{$type.GO.Elem | ref}}, len(vSlice)) for i := range vSlice { - res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -29,28 +30,20 @@ {{- if $type.Unmarshaler }} {{- if $type.CastType }} tmp, err := {{ $type.Unmarshaler | call }}(v) - return {{ $type.GO | ref }}(tmp), err + return {{ $type.GO | ref }}(tmp), graphql.WrapErrorWithInputPath(ctx, err) {{- else}} - return {{ $type.Unmarshaler | call }}(v) + res, err := {{ $type.Unmarshaler | call }}(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) {{- end }} {{- else if eq ($type.GO | ref) "map[string]interface{}" }} return v.(map[string]interface{}), nil {{- else if $type.IsMarshaler }} var res {{ $type.GO | ref }} err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) {{- else }} - return ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v) + res, err := ec.unmarshalInput{{ $type.GQL.Name }}(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) {{- end }} {{- end }} } diff --git a/docs/content/reference/scalars.md b/docs/content/reference/scalars.md index d3858c80aa1..d8d9ae4be18 100644 --- a/docs/content/reference/scalars.md +++ b/docs/content/reference/scalars.md @@ -148,3 +148,57 @@ models: ``` See the [example/scalars](https://github.com/99designs/gqlgen/tree/master/example/scalars) package for more examples. + +## Unmarshaling Errors + +The errors that occur as part of custom scalar unmarshaling will return a full path to the field. +For example, given the following schema ... + +```graphql +extend type Mutation{ + updateUser(userInput: UserInput!): User! +} + +input UserInput { + name: String! + primaryContactDetails: ContactDetailsInput! + secondaryContactDetails: ContactDetailsInput! +} + +scalar Email +input ContactDetailsInput { + email: Email! +} +``` + +... and the following variables: + +```json + +{ + "userInput": { + "name": "George", + "primaryContactDetails": { + "email": "not-an-email" + }, + "secondaryContactDetails": { + "email": "george@gmail.com" + } + } +} +``` + +... and an unmarshal function that returns an error if the email is invalid. The mutation will return an error containing the full path: +```json +{ + "message": "email invalid", + "path": [ + "updateUser", + "userInput", + "primaryContactDetails", + "email" + ] +} +``` + + diff --git a/graphql/context_field_input.go b/graphql/context_field_input.go index 37a0319b7b2..84fe9882854 100644 --- a/graphql/context_field_input.go +++ b/graphql/context_field_input.go @@ -3,6 +3,7 @@ package graphql import ( "context" "github.com/vektah/gqlparser/v2/ast" + "github.com/vektah/gqlparser/v2/gqlerror" ) const fieldInputCtx key = "field_input_context" @@ -64,3 +65,20 @@ func GetFieldInputContext(ctx context.Context) *FieldInputContext { } return nil } + +func WrapErrorWithInputPath(ctx context.Context, err error) error { + if err == nil { + return nil + } + + inputContext := GetFieldInputContext(ctx) + path := inputContext.Path() + if gerr, ok := err.(*gqlerror.Error); ok { + if gerr.Path == nil { + gerr.Path = path + } + return gerr + } else { + return gqlerror.WrapPath(path, err) + } +} From fd615cf6d4f829e38f0d52cf2c3de886d65d463b Mon Sep 17 00:00:00 2001 From: Bogdan Dumitru Date: Fri, 20 Mar 2020 09:14:47 +0100 Subject: [PATCH 4/7] Fix linting --- codegen/testserver/mutation_with_custom_scalar_test.go | 3 ++- graphql/context_field_input.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/codegen/testserver/mutation_with_custom_scalar_test.go b/codegen/testserver/mutation_with_custom_scalar_test.go index fbad2189590..6cc022172c2 100644 --- a/codegen/testserver/mutation_with_custom_scalar_test.go +++ b/codegen/testserver/mutation_with_custom_scalar_test.go @@ -2,10 +2,11 @@ package testserver import ( "context" + "testing" + "github.com/99designs/gqlgen/client" "github.com/99designs/gqlgen/graphql/handler" "github.com/stretchr/testify/require" - "testing" ) func TestErrorInsideMutationArgument(t *testing.T) { diff --git a/graphql/context_field_input.go b/graphql/context_field_input.go index 84fe9882854..0ed6f8b6602 100644 --- a/graphql/context_field_input.go +++ b/graphql/context_field_input.go @@ -2,6 +2,7 @@ package graphql import ( "context" + "github.com/vektah/gqlparser/v2/ast" "github.com/vektah/gqlparser/v2/gqlerror" ) From 65be2a6e80792993384534da9794c7a47da78244 Mon Sep 17 00:00:00 2001 From: Bogdan Dumitru Date: Fri, 20 Mar 2020 09:23:27 +0100 Subject: [PATCH 5/7] Run generate --- example/chat/generated.go | 33 +++-- example/config/generated.go | 41 ++++--- example/dataloader/generated.go | 46 ++++--- .../accounts/graph/generated/generated.go | 41 ++++--- .../products/graph/generated/generated.go | 46 ++++--- .../reviews/graph/generated/generated.go | 41 ++++--- example/fileupload/generated.go | 50 +++++--- example/scalars/generated.go | 105 +++++----------- example/selection/generated.go | 35 ++++-- example/starwars/generated/exec.go | 113 ++++++++---------- example/todo/generated.go | 49 ++++---- example/type-system-extension/generated.go | 46 ++++--- integration/generated.go | 77 ++++++------ 13 files changed, 372 insertions(+), 351 deletions(-) diff --git a/example/chat/generated.go b/example/chat/generated.go index f930cc0bd44..08608621288 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -2337,7 +2337,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2351,7 +2352,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2416,7 +2418,8 @@ func (ec *executionContext) marshalNMessage2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2430,7 +2433,8 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S } func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return graphql.UnmarshalTime(v) + res, err := graphql.UnmarshalTime(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -2485,7 +2489,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2510,9 +2515,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2656,7 +2662,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2670,7 +2677,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2682,7 +2690,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2704,7 +2712,8 @@ func (ec *executionContext) marshalOChatroom2ᚖgithubᚗcomᚋ99designsᚋgqlge } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2716,7 +2725,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/config/generated.go b/example/config/generated.go index 21228158833..a45bb35fa02 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -2209,7 +2209,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2223,7 +2224,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2237,7 +2239,8 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2251,11 +2254,13 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti } func (ec *executionContext) unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(ctx context.Context, v interface{}) (NewTodo, error) { - return ec.unmarshalInputNewTodo(ctx, v) + res, err := ec.unmarshalInputNewTodo(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2375,7 +2380,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2400,9 +2406,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2546,7 +2553,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2560,7 +2568,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2572,7 +2581,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2583,7 +2592,8 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2602,9 +2612,10 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2627,7 +2638,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index cc13907e7ad..9bdeb99a091 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -2504,7 +2504,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2532,7 +2533,8 @@ func (ec *executionContext) marshalNCustomer2ᚖgithubᚗcomᚋ99designsᚋgqlge } func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v interface{}) (float64, error) { - return graphql.UnmarshalFloat(v) + res, err := graphql.UnmarshalFloat(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { @@ -2546,7 +2548,8 @@ func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.S } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2588,7 +2591,8 @@ func (ec *executionContext) marshalNOrder2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2602,7 +2606,8 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S } func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return graphql.UnmarshalTime(v) + res, err := graphql.UnmarshalTime(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -2657,7 +2662,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2682,9 +2688,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2828,7 +2835,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2853,7 +2861,8 @@ func (ec *executionContext) marshalOAddress2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2865,7 +2874,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2967,9 +2976,10 @@ func (ec *executionContext) unmarshalOInt2ᚕintᚄ(ctx context.Context, v inter var err error res := make([]int, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNInt2int(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNInt2int(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2999,9 +3009,10 @@ func (ec *executionContext) unmarshalOInt2ᚕᚕint(ctx context.Context, v inter var err error res := make([][]int, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalOInt2ᚕintᚄ(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOInt2ᚕintᚄ(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -3100,7 +3111,8 @@ func (ec *executionContext) marshalOOrder2ᚕᚖgithubᚗcomᚋ99designsᚋgqlge } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -3112,7 +3124,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/federation/accounts/graph/generated/generated.go b/example/federation/accounts/graph/generated/generated.go index 3d91fd0ac6e..db8611f60c6 100644 --- a/example/federation/accounts/graph/generated/generated.go +++ b/example/federation/accounts/graph/generated/generated.go @@ -2129,7 +2129,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2143,7 +2144,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2157,7 +2159,8 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2188,7 +2191,8 @@ func (ec *executionContext) unmarshalN_Any2map(ctx context.Context, v interface{ if v == nil { return nil, nil } - return graphql.UnmarshalMap(v) + res, err := graphql.UnmarshalMap(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN_Any2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { @@ -2219,9 +2223,10 @@ func (ec *executionContext) unmarshalN_Any2ᚕmapᚄ(ctx context.Context, v inte var err error res := make([]map[string]interface{}, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN_Any2map(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN_Any2map(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2274,7 +2279,8 @@ func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN_FieldSet2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN_FieldSet2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2333,7 +2339,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2358,9 +2365,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2504,7 +2512,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2518,7 +2527,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2530,7 +2540,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2541,7 +2551,8 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2553,7 +2564,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/federation/products/graph/generated/generated.go b/example/federation/products/graph/generated/generated.go index 054aee218a5..8b5f3176733 100644 --- a/example/federation/products/graph/generated/generated.go +++ b/example/federation/products/graph/generated/generated.go @@ -2204,7 +2204,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2218,7 +2219,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2246,7 +2248,8 @@ func (ec *executionContext) marshalNProduct2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2263,7 +2266,8 @@ func (ec *executionContext) unmarshalN_Any2map(ctx context.Context, v interface{ if v == nil { return nil, nil } - return graphql.UnmarshalMap(v) + res, err := graphql.UnmarshalMap(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN_Any2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { @@ -2294,9 +2298,10 @@ func (ec *executionContext) unmarshalN_Any2ᚕmapᚄ(ctx context.Context, v inte var err error res := make([]map[string]interface{}, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN_Any2map(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN_Any2map(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2349,7 +2354,8 @@ func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN_FieldSet2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN_FieldSet2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2408,7 +2414,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2433,9 +2440,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2579,7 +2587,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2593,7 +2602,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2605,7 +2615,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2616,7 +2626,8 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast } func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2628,7 +2639,7 @@ func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interfac return nil, nil } res, err := ec.unmarshalOInt2int(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { @@ -2690,7 +2701,8 @@ func (ec *executionContext) marshalOProduct2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2702,7 +2714,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/federation/reviews/graph/generated/generated.go b/example/federation/reviews/graph/generated/generated.go index 2097f308f5a..2c677f166ed 100644 --- a/example/federation/reviews/graph/generated/generated.go +++ b/example/federation/reviews/graph/generated/generated.go @@ -2473,7 +2473,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2487,7 +2488,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2515,7 +2517,8 @@ func (ec *executionContext) marshalNProduct2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2546,7 +2549,8 @@ func (ec *executionContext) unmarshalN_Any2map(ctx context.Context, v interface{ if v == nil { return nil, nil } - return graphql.UnmarshalMap(v) + res, err := graphql.UnmarshalMap(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN_Any2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { @@ -2577,9 +2581,10 @@ func (ec *executionContext) unmarshalN_Any2ᚕmapᚄ(ctx context.Context, v inte var err error res := make([]map[string]interface{}, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN_Any2map(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN_Any2map(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2632,7 +2637,8 @@ func (ec *executionContext) marshalN_Entity2ᚕgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN_FieldSet2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN_FieldSet2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2691,7 +2697,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2716,9 +2723,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2862,7 +2870,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2876,7 +2885,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2888,7 +2898,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2950,7 +2960,8 @@ func (ec *executionContext) marshalOReview2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2962,7 +2973,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 0d7f79e0712..f2dcbc697dc 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -2257,7 +2257,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2322,7 +2323,8 @@ func (ec *executionContext) marshalNFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2336,7 +2338,8 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2350,7 +2353,8 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S } func (ec *executionContext) unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, v interface{}) (graphql.Upload, error) { - return graphql.UnmarshalUpload(v) + res, err := graphql.UnmarshalUpload(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v graphql.Upload) graphql.Marshaler { @@ -2375,9 +2379,10 @@ func (ec *executionContext) unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgq var err error res := make([]*graphql.Upload, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2397,7 +2402,7 @@ func (ec *executionContext) unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlge return nil, nil } res, err := ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, sel ast.SelectionSet, v *graphql.Upload) graphql.Marshaler { @@ -2411,7 +2416,8 @@ func (ec *executionContext) marshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx context.Context, v interface{}) (model.UploadFile, error) { - return ec.unmarshalInputUploadFile(ctx, v) + res, err := ec.unmarshalInputUploadFile(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFileᚄ(ctx context.Context, v interface{}) ([]*model.UploadFile, error) { @@ -2426,9 +2432,10 @@ func (ec *executionContext) unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designs var err error res := make([]*model.UploadFile, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNUploadFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNUploadFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2439,7 +2446,7 @@ func (ec *executionContext) unmarshalNUploadFile2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { @@ -2484,7 +2491,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2509,9 +2517,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2655,7 +2664,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2669,7 +2679,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2681,7 +2692,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2692,7 +2703,8 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2704,7 +2716,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/scalars/generated.go b/example/scalars/generated.go index be38290ada7..40bca23c1fc 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -17,7 +17,6 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -2341,17 +2340,7 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o func (ec *executionContext) unmarshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, v interface{}) (model.Banned, error) { var res model.Banned err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, sel ast.SelectionSet, v model.Banned) graphql.Marshaler { @@ -2359,7 +2348,8 @@ func (ec *executionContext) marshalNBanned2githubᚗcomᚋ99designsᚋgqlgenᚋe } func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2373,7 +2363,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx context.Context, v interface{}) (external.ObjectID, error) { - return model.UnmarshalID(v) + res, err := model.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx context.Context, sel ast.SelectionSet, v external.ObjectID) graphql.Marshaler { @@ -2389,17 +2380,7 @@ func (ec *executionContext) marshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexamp func (ec *executionContext) unmarshalNPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, v interface{}) (model.Point, error) { var res model.Point err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v model.Point) graphql.Marshaler { @@ -2411,7 +2392,7 @@ func (ec *executionContext) unmarshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgen return nil, nil } res, err := ec.unmarshalNPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v *model.Point) graphql.Marshaler { @@ -2425,7 +2406,8 @@ func (ec *executionContext) marshalNPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2531,7 +2513,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2556,9 +2539,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2702,7 +2686,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2722,17 +2707,7 @@ func (ec *executionContext) marshalOAddress2githubᚗcomᚋ99designsᚋgqlgenᚋ func (ec *executionContext) unmarshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, v interface{}) (model.Banned, error) { var res model.Banned err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx context.Context, sel ast.SelectionSet, v model.Banned) graphql.Marshaler { @@ -2740,7 +2715,8 @@ func (ec *executionContext) marshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋe } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2752,7 +2728,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2765,17 +2741,7 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast func (ec *executionContext) unmarshalOPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, v interface{}) (model.Point, error) { var res model.Point err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v model.Point) graphql.Marshaler { @@ -2787,7 +2753,7 @@ func (ec *executionContext) unmarshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgen return nil, nil } res, err := ec.unmarshalOPoint2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx context.Context, sel ast.SelectionSet, v *model.Point) graphql.Marshaler { @@ -2798,7 +2764,8 @@ func (ec *executionContext) marshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOSearchArgs2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx context.Context, v interface{}) (model.SearchArgs, error) { - return ec.unmarshalInputSearchArgs(ctx, v) + res, err := ec.unmarshalInputSearchArgs(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx context.Context, v interface{}) (*model.SearchArgs, error) { @@ -2806,11 +2773,12 @@ func (ec *executionContext) unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalOSearchArgs2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2822,7 +2790,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { @@ -2835,17 +2803,7 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as func (ec *executionContext) unmarshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx context.Context, v interface{}) (model.Tier, error) { var res model.Tier err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐTier(ctx context.Context, sel ast.SelectionSet, v model.Tier) graphql.Marshaler { @@ -2853,7 +2811,8 @@ func (ec *executionContext) marshalOTier2githubᚗcomᚋ99designsᚋgqlgenᚋexa } func (ec *executionContext) unmarshalOTimestamp2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return model.UnmarshalTimestamp(v) + res, err := model.UnmarshalTimestamp(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTimestamp2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -2865,7 +2824,7 @@ func (ec *executionContext) unmarshalOTimestamp2ᚖtimeᚐTime(ctx context.Conte return nil, nil } res, err := ec.unmarshalOTimestamp2timeᚐTime(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTimestamp2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { diff --git a/example/selection/generated.go b/example/selection/generated.go index 13ae4cf8bee..4bed086cc8d 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -2083,7 +2083,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2107,7 +2108,8 @@ func (ec *executionContext) marshalNEvent2githubᚗcomᚋ99designsᚋgqlgenᚋex } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2121,7 +2123,8 @@ func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.S } func (ec *executionContext) unmarshalNTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return graphql.UnmarshalTime(v) + res, err := graphql.UnmarshalTime(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -2176,7 +2179,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2201,9 +2205,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2347,7 +2352,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2361,7 +2367,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2373,7 +2380,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2424,7 +2431,8 @@ func (ec *executionContext) marshalOEvent2ᚕgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2443,9 +2451,10 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2468,7 +2477,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 55f52a63115..f70225f422a 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -17,7 +17,6 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -4241,7 +4240,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -4267,17 +4267,7 @@ func (ec *executionContext) marshalNCharacter2githubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, v interface{}) (models.Episode, error) { var res models.Episode err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, sel ast.SelectionSet, v models.Episode) graphql.Marshaler { @@ -4296,9 +4286,10 @@ func (ec *executionContext) unmarshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlg var err error res := make([]models.Episode, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -4342,7 +4333,8 @@ func (ec *executionContext) marshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNFloat2float64(ctx context.Context, v interface{}) (float64, error) { - return graphql.UnmarshalFloat(v) + res, err := graphql.UnmarshalFloat(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { @@ -4384,7 +4376,8 @@ func (ec *executionContext) marshalNFriendsEdge2ᚖgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -4398,7 +4391,8 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -4423,9 +4417,10 @@ func (ec *executionContext) unmarshalNInt2ᚕintᚄ(ctx context.Context, v inter var err error res := make([]int, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNInt2int(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNInt2int(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -4452,9 +4447,10 @@ func (ec *executionContext) unmarshalNInt2ᚕᚕintᚄ(ctx context.Context, v in var err error res := make([][]int, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNInt2ᚕintᚄ(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNInt2ᚕintᚄ(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -4525,7 +4521,8 @@ func (ec *executionContext) marshalNReview2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx context.Context, v interface{}) (models.Review, error) { - return ec.unmarshalInputReviewInput(ctx, v) + res, err := ec.unmarshalInputReviewInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNSearchResult2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐSearchResult(ctx context.Context, sel ast.SelectionSet, v models.SearchResult) graphql.Marshaler { @@ -4590,7 +4587,8 @@ func (ec *executionContext) marshalNStarship2ᚖgithubᚗcomᚋ99designsᚋgqlge } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -4645,7 +4643,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -4670,9 +4669,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -4816,7 +4816,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -4830,7 +4831,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -4842,7 +4844,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -4913,17 +4915,7 @@ func (ec *executionContext) marshalODroid2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalOEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, v interface{}) (models.Episode, error) { var res models.Episode err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, sel ast.SelectionSet, v models.Episode) graphql.Marshaler { @@ -4935,7 +4927,7 @@ func (ec *executionContext) unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlg return nil, nil } res, err := ec.unmarshalOEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx context.Context, sel ast.SelectionSet, v *models.Episode) graphql.Marshaler { @@ -4946,7 +4938,8 @@ func (ec *executionContext) marshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOFloat2float64(ctx context.Context, v interface{}) (float64, error) { - return graphql.UnmarshalFloat(v) + res, err := graphql.UnmarshalFloat(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOFloat2float64(ctx context.Context, sel ast.SelectionSet, v float64) graphql.Marshaler { @@ -5005,7 +4998,8 @@ func (ec *executionContext) marshalOHuman2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalOID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -5017,7 +5011,7 @@ func (ec *executionContext) unmarshalOID2ᚖstring(ctx context.Context, v interf return nil, nil } res, err := ec.unmarshalOID2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { @@ -5028,7 +5022,8 @@ func (ec *executionContext) marshalOID2ᚖstring(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -5040,7 +5035,7 @@ func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interfac return nil, nil } res, err := ec.unmarshalOInt2int(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { @@ -5053,17 +5048,7 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele func (ec *executionContext) unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx context.Context, v interface{}) (models.LengthUnit, error) { var res models.LengthUnit err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx context.Context, sel ast.SelectionSet, v models.LengthUnit) graphql.Marshaler { @@ -5075,7 +5060,7 @@ func (ec *executionContext) unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋg return nil, nil } res, err := ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx context.Context, sel ast.SelectionSet, v *models.LengthUnit) graphql.Marshaler { @@ -5148,7 +5133,8 @@ func (ec *executionContext) marshalOStarship2ᚖgithubᚗcomᚋ99designsᚋgqlge } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -5160,7 +5146,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { @@ -5171,7 +5157,8 @@ func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel as } func (ec *executionContext) unmarshalOTime2timeᚐTime(ctx context.Context, v interface{}) (time.Time, error) { - return graphql.UnmarshalTime(v) + res, err := graphql.UnmarshalTime(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTime2timeᚐTime(ctx context.Context, sel ast.SelectionSet, v time.Time) graphql.Marshaler { @@ -5183,7 +5170,7 @@ func (ec *executionContext) unmarshalOTime2ᚖtimeᚐTime(ctx context.Context, v return nil, nil } res, err := ec.unmarshalOTime2timeᚐTime(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOTime2ᚖtimeᚐTime(ctx context.Context, sel ast.SelectionSet, v *time.Time) graphql.Marshaler { diff --git a/example/todo/generated.go b/example/todo/generated.go index 0225172cd9d..c19a172959a 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -15,7 +15,6 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -2231,7 +2230,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2245,7 +2245,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalIntID(v) + res, err := graphql.UnmarshalIntID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2262,7 +2263,8 @@ func (ec *executionContext) unmarshalNMap2map(ctx context.Context, v interface{} if v == nil { return nil, nil } - return graphql.UnmarshalMap(v) + res, err := graphql.UnmarshalMap(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNMap2map(ctx context.Context, sel ast.SelectionSet, v map[string]interface{}) graphql.Marshaler { @@ -2284,17 +2286,7 @@ func (ec *executionContext) marshalNMap2map(ctx context.Context, sel ast.Selecti func (ec *executionContext) unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx context.Context, v interface{}) (Role, error) { var res Role err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx context.Context, sel ast.SelectionSet, v Role) graphql.Marshaler { @@ -2302,7 +2294,8 @@ func (ec *executionContext) marshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexa } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2367,7 +2360,8 @@ func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ } func (ec *executionContext) unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(ctx context.Context, v interface{}) (TodoInput, error) { - return ec.unmarshalInputTodoInput(ctx, v) + res, err := ec.unmarshalInputTodoInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { @@ -2412,7 +2406,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2437,9 +2432,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2583,7 +2579,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2597,7 +2594,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2609,7 +2607,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2620,7 +2618,8 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2632,7 +2631,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index e39b31b71d7..03fe03e5b61 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -15,7 +15,6 @@ import ( "github.com/99designs/gqlgen/graphql/introspection" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -2206,7 +2205,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2220,7 +2220,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNID2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalID(v) + res, err := graphql.UnmarshalID(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2236,17 +2237,7 @@ func (ec *executionContext) marshalNID2string(ctx context.Context, sel ast.Selec func (ec *executionContext) unmarshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx context.Context, v interface{}) (State, error) { var res State err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐState(ctx context.Context, sel ast.SelectionSet, v State) graphql.Marshaler { @@ -2254,7 +2245,8 @@ func (ec *executionContext) marshalNState2githubᚗcomᚋ99designsᚋgqlgenᚋex } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2319,7 +2311,8 @@ func (ec *executionContext) marshalNTodo2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ } func (ec *executionContext) unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx context.Context, v interface{}) (TodoInput, error) { - return ec.unmarshalInputTodoInput(ctx, v) + res, err := ec.unmarshalInputTodoInput(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { @@ -2364,7 +2357,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2389,9 +2383,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2535,7 +2530,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2549,7 +2545,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2561,7 +2558,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2572,7 +2569,8 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2584,7 +2582,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { diff --git a/integration/generated.go b/integration/generated.go index bc62636e861..0af74b0e430 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -16,7 +16,6 @@ import ( "github.com/99designs/gqlgen/integration/remote_api" gqlparser "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "github.com/vektah/gqlparser/v2/gqlerror" ) // region ************************** generated!.gotpl ************************** @@ -2497,7 +2496,8 @@ func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, o // region ***************************** type.gotpl ***************************** func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2511,7 +2511,8 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se } func (ec *executionContext) unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(ctx context.Context, v interface{}) (models.DateFilter, error) { - return ec.unmarshalInputDateFilter(ctx, v) + res, err := ec.unmarshalInputDateFilter(ctx, v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNElement2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐElement(ctx context.Context, sel ast.SelectionSet, v models.Element) graphql.Marshaler { @@ -2529,7 +2530,8 @@ func (ec *executionContext) marshalNElement2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -2543,7 +2545,8 @@ func (ec *executionContext) marshalNInt2int(ctx context.Context, sel ast.Selecti } func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2568,9 +2571,10 @@ func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2627,7 +2631,8 @@ func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgq } func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2652,9 +2657,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2798,7 +2804,8 @@ func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgen } func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -2812,7 +2819,8 @@ func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel a } func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - return graphql.UnmarshalBoolean(v) + res, err := graphql.UnmarshalBoolean(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { @@ -2831,9 +2839,10 @@ func (ec *executionContext) unmarshalOBoolean2ᚕboolᚄ(ctx context.Context, v var err error res := make([]bool, len(vSlice)) for i := range vSlice { - res[i], err = ec.unmarshalNBoolean2bool(ctx, vSlice[i]) + nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNBoolean2bool(nctx, vSlice[i]) if err != nil { - return nil, err + return nil, graphql.WrapErrorWithInputPath(nctx, err) } } return res, nil @@ -2856,7 +2865,7 @@ func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v int return nil, nil } res, err := ec.unmarshalOBoolean2bool(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { @@ -2869,17 +2878,7 @@ func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast func (ec *executionContext) unmarshalODATE_FILTER_OP2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx context.Context, v interface{}) (models.DateFilterOp, error) { var res models.DateFilterOp err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalODATE_FILTER_OP2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx context.Context, sel ast.SelectionSet, v models.DateFilterOp) graphql.Marshaler { @@ -2891,7 +2890,7 @@ func (ec *executionContext) unmarshalODATE_FILTER_OP2ᚖgithubᚗcomᚋ99designs return nil, nil } res, err := ec.unmarshalODATE_FILTER_OP2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalODATE_FILTER_OP2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx context.Context, sel ast.SelectionSet, v *models.DateFilterOp) graphql.Marshaler { @@ -2955,17 +2954,7 @@ func (ec *executionContext) marshalOElement2ᚖgithubᚗcomᚋ99designsᚋgqlgen func (ec *executionContext) unmarshalOErrorType2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx context.Context, v interface{}) (models.ErrorType, error) { var res models.ErrorType err := res.UnmarshalGQL(v) - if err != nil { - fic := graphql.GetFieldInputContext(ctx) - path := fic.Path() - if gerr, ok := err.(*gqlerror.Error); ok { - gerr.Path = path - return res, gerr - } else { - return res, gqlerror.WrapPath(path, err) - } - } - return res, nil + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOErrorType2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx context.Context, sel ast.SelectionSet, v models.ErrorType) graphql.Marshaler { @@ -2977,7 +2966,7 @@ func (ec *executionContext) unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgq return nil, nil } res, err := ec.unmarshalOErrorType2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx context.Context, sel ast.SelectionSet, v *models.ErrorType) graphql.Marshaler { @@ -2988,7 +2977,8 @@ func (ec *executionContext) marshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlg } func (ec *executionContext) unmarshalOInt2int(ctx context.Context, v interface{}) (int, error) { - return graphql.UnmarshalInt(v) + res, err := graphql.UnmarshalInt(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2int(ctx context.Context, sel ast.SelectionSet, v int) graphql.Marshaler { @@ -3000,7 +2990,7 @@ func (ec *executionContext) unmarshalOInt2ᚖint(ctx context.Context, v interfac return nil, nil } res, err := ec.unmarshalOInt2int(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.SelectionSet, v *int) graphql.Marshaler { @@ -3011,7 +3001,8 @@ func (ec *executionContext) marshalOInt2ᚖint(ctx context.Context, sel ast.Sele } func (ec *executionContext) unmarshalOString2string(ctx context.Context, v interface{}) (string, error) { - return graphql.UnmarshalString(v) + res, err := graphql.UnmarshalString(v) + return res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { @@ -3023,7 +3014,7 @@ func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v in return nil, nil } res, err := ec.unmarshalOString2string(ctx, v) - return &res, err + return &res, graphql.WrapErrorWithInputPath(ctx, err) } func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { From 8ea5ba2b3f0851c7de1312a24c14e234d051b0bb Mon Sep 17 00:00:00 2001 From: Bogdan Dumitru Date: Fri, 20 Mar 2020 09:29:48 +0100 Subject: [PATCH 6/7] Fix additional missed tests --- example/dataloader/dataloader_test.go | 2 +- example/scalars/scalar_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/dataloader/dataloader_test.go b/example/dataloader/dataloader_test.go index 17df8076027..d61cc9ec718 100644 --- a/example/dataloader/dataloader_test.go +++ b/example/dataloader/dataloader_test.go @@ -82,7 +82,7 @@ func TestTodo(t *testing.T) { } err := c.Post(`{ torture2d(customerIds:{}) { id name } }`, &resp) - require.EqualError(t, err, "[{\"message\":\"map[string]interface {} is not an int\",\"path\":[\"torture2d\"]}]") + require.EqualError(t, err, "[{\"message\":\"map[string]interface {} is not an int\",\"path\":[\"torture2d\",\"customerIds\",0,0]}]") }) } diff --git a/example/scalars/scalar_test.go b/example/scalars/scalar_test.go index 85ac48c3911..f9ca2b1dd14 100644 --- a/example/scalars/scalar_test.go +++ b/example/scalars/scalar_test.go @@ -59,7 +59,7 @@ func TestScalars(t *testing.T) { var resp struct{ Search []RawUser } err := c.Post(`{ search(input:{createdAfter:"2014"}) { id } }`, &resp) - require.EqualError(t, err, `[{"message":"time should be a unix timestamp","path":["search"]}]`) + require.EqualError(t, err, `[{"message":"time should be a unix timestamp","path":["search","input","createdAfter"]}]`) }) t.Run("scalar resolver methods", func(t *testing.T) { From bde4291cfa7669a889db6e5e518218a855ffd433 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Sun, 26 Jul 2020 13:34:29 +1000 Subject: [PATCH 7/7] shadow context to ensure scoped context use --- codegen/args.gotpl | 8 +- codegen/input.gotpl | 8 +- codegen/testserver/generated.go | 500 +++++++++--------- codegen/type.gotpl | 6 +- example/chat/generated.go | 42 +- example/config/generated.go | 36 +- example/dataloader/generated.go | 38 +- .../accounts/graph/generated/generated.go | 32 +- .../products/graph/generated/generated.go | 36 +- .../reviews/graph/generated/generated.go | 36 +- example/fileupload/generated.go | 54 +- example/scalars/generated.go | 38 +- example/selection/generated.go | 24 +- example/starwars/generated/exec.go | 112 ++-- example/todo/generated.go | 50 +- example/type-system-extension/generated.go | 30 +- integration/generated.go | 58 +- 17 files changed, 554 insertions(+), 554 deletions(-) diff --git a/codegen/args.gotpl b/codegen/args.gotpl index afe58032801..b25d444b501 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -5,11 +5,11 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] {{- range $i, $arg := . }} var arg{{$i}} {{ $arg.TypeReference.GO | ref}} if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField({{$arg.Name|quote}})) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField({{$arg.Name|quote}})) {{- if $arg.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(childCtx, tmp) } + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } {{ template "implDirectives" $arg }} - tmp, err = directive{{$arg.ImplDirectives|len}}(childCtx) + tmp, err = directive{{$arg.ImplDirectives|len}}(ctx) if err != nil { return nil, err } @@ -23,7 +23,7 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string] return nil, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp) } {{- else }} - arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(childCtx, tmp) + arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) if err != nil { return nil, err } diff --git a/codegen/input.gotpl b/codegen/input.gotpl index 815f466bb8f..56f9347c422 100644 --- a/codegen/input.gotpl +++ b/codegen/input.gotpl @@ -17,11 +17,11 @@ case {{$field.Name|quote}}: var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField({{$field.Name|quote}})) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField({{$field.Name|quote}})) {{- if $field.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(childCtx, v) } + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) } {{ template "implDirectives" $field }} - tmp, err := directive{{$field.ImplDirectives|len}}(childCtx) + tmp, err := directive{{$field.ImplDirectives|len}}(ctx) if err != nil { return it, err } @@ -35,7 +35,7 @@ return it, fmt.Errorf(`unexpected type %T from directive, should be {{ $field.TypeReference.GO }}`, tmp) } {{- else }} - it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(childCtx, v) + it.{{$field.GoFieldName}}, err = ec.{{ $field.TypeReference.UnmarshalFunc }}(ctx, v) if err != nil { return it, err } diff --git a/codegen/testserver/generated.go b/codegen/testserver/generated.go index f2c8434bb22..584ff77306a 100644 --- a/codegen/testserver/generated.go +++ b/codegen/testserver/generated.go @@ -2339,8 +2339,8 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["min"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("min")) - arg0, err = ec.unmarshalNInt2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("min")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } @@ -2348,8 +2348,8 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str args["min"] = arg0 var arg1 *int if tmp, ok := rawArgs["max"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("max")) - arg1, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -2357,8 +2357,8 @@ func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[str args["max"] = arg1 var arg2 *string if tmp, ok := rawArgs["message"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("message")) - arg2, err = ec.unmarshalOString2ᚖstring(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("message")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) if err != nil { return nil, err } @@ -2372,8 +2372,8 @@ func (ec *executionContext) dir_logged_args(ctx context.Context, rawArgs map[str args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNUUID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNUUID2string(ctx, tmp) if err != nil { return nil, err } @@ -2387,8 +2387,8 @@ func (ec *executionContext) dir_order_args(ctx context.Context, rawArgs map[stri args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["location"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("location")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("location")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -2402,8 +2402,8 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["min"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("min")) - arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("min")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -2411,8 +2411,8 @@ func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[stri args["min"] = arg0 var arg1 *int if tmp, ok := rawArgs["max"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("max")) - arg1, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -2426,8 +2426,8 @@ func (ec *executionContext) field_Mutation_updateSomething_args(ctx context.Cont args := map[string]interface{}{} var arg0 SpecialInput if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSpecialInput(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐSpecialInput(ctx, tmp) if err != nil { return nil, err } @@ -2441,8 +2441,8 @@ func (ec *executionContext) field_Panics_argUnmarshal_args(ctx context.Context, args := map[string]interface{}{} var arg0 []MarshalPanic if tmp, ok := rawArgs["u"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("u")) - arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(ctx, tmp) if err != nil { return nil, err } @@ -2456,8 +2456,8 @@ func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Conte args := map[string]interface{}{} var arg0 []MarshalPanic if tmp, ok := rawArgs["u"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("u")) - arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanicᚄ(ctx, tmp) if err != nil { return nil, err } @@ -2471,8 +2471,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -2486,8 +2486,8 @@ func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalNDefaultScalarImplementation2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) if err != nil { return nil, err } @@ -2501,8 +2501,8 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, r args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + 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) if err != nil { @@ -2522,7 +2522,7 @@ func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, r return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2541,8 +2541,8 @@ func (ec *executionContext) field_Query_directiveFieldDef_args(ctx context.Conte args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["ret"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("ret")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("ret")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -2556,8 +2556,8 @@ func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context. args := map[string]interface{}{} var arg0 *InputDirectives if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) if err != nil { return nil, err } @@ -2571,9 +2571,9 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont args := map[string]interface{}{} var arg0 InnerInput if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) directive0 := func(ctx context.Context) (interface{}, error) { - return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(childCtx, tmp) + return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Custom == nil { @@ -2582,7 +2582,7 @@ func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Cont return ec.directives.Custom(ctx, rawArgs, directive0) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2601,8 +2601,8 @@ func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, args := map[string]interface{}{} var arg0 InputDirectives if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputDirectives(ctx, tmp) if err != nil { return nil, err } @@ -2616,8 +2616,8 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + 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 { @@ -2629,7 +2629,7 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2644,8 +2644,8 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co args["arg"] = arg0 var arg1 *int if tmp, ok := rawArgs["arg2"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg2")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg2")) + 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 { @@ -2657,7 +2657,7 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2672,8 +2672,8 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co args["arg2"] = arg1 var arg2 *string if tmp, ok := rawArgs["arg3"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg3")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg3")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { return nil, errors.New("directive toNull is not implemented") @@ -2681,7 +2681,7 @@ func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Co return ec.directives.ToNull(ctx, rawArgs, directive0) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2702,8 +2702,8 @@ func (ec *executionContext) field_Query_enumInInput_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 *InputWithEnumValue if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInputWithEnumValue(ctx, tmp) if err != nil { return nil, err } @@ -2717,8 +2717,8 @@ func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 FallbackToStringEncoding if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐFallbackToStringEncoding(ctx, tmp) if err != nil { return nil, err } @@ -2732,8 +2732,8 @@ func (ec *executionContext) field_Query_inputNullableSlice_args(ctx context.Cont args := map[string]interface{}{} var arg0 []string if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalOString2ᚕstringᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) if err != nil { return nil, err } @@ -2747,8 +2747,8 @@ func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, raw args := map[string]interface{}{} var arg0 []string if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalNString2ᚕstringᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) if err != nil { return nil, err } @@ -2762,8 +2762,8 @@ func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 map[string]interface{} if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalOChanges2map(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOChanges2map(ctx, tmp) if err != nil { return nil, err } @@ -2777,8 +2777,8 @@ func (ec *executionContext) field_Query_mapNestedStringInterface_args(ctx contex args := map[string]interface{}{} var arg0 *NestedMapInput if tmp, ok := rawArgs["in"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("in")) - arg0, err = ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("in")) + arg0, err = ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedMapInput(ctx, tmp) if err != nil { return nil, err } @@ -2792,8 +2792,8 @@ func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Cont args := map[string]interface{}{} var arg0 map[string]interface{} if tmp, ok := rawArgs["in"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("in")) - arg0, err = ec.unmarshalOMapStringInterfaceInput2map(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("in")) + arg0, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) if err != nil { return nil, err } @@ -2807,8 +2807,8 @@ func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, r args := map[string]interface{}{} var arg0 [][]*OuterInput if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, tmp) if err != nil { return nil, err } @@ -2822,8 +2822,8 @@ func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -2837,8 +2837,8 @@ func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 *RecursiveInputSlice if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, tmp) if err != nil { return nil, err } @@ -2852,8 +2852,8 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNInt2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } @@ -2867,8 +2867,8 @@ func (ec *executionContext) field_Subscription_directiveArg_args(ctx context.Con args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + 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) if err != nil { @@ -2888,7 +2888,7 @@ func (ec *executionContext) field_Subscription_directiveArg_args(ctx context.Con return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2907,8 +2907,8 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["arg"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg")) + 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 { @@ -2920,7 +2920,7 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2935,8 +2935,8 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con args["arg"] = arg0 var arg1 *int if tmp, ok := rawArgs["arg2"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg2")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInt2ᚖint(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg2")) + 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 { @@ -2948,7 +2948,7 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2963,8 +2963,8 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con args["arg2"] = arg1 var arg2 *string if tmp, ok := rawArgs["arg3"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg3")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(childCtx, tmp) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("arg3")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, tmp) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { return nil, errors.New("directive toNull is not implemented") @@ -2972,7 +2972,7 @@ func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx con return ec.directives.ToNull(ctx, rawArgs, directive0) } - tmp, err = directive1(childCtx) + tmp, err = directive1(ctx) if err != nil { return nil, err } @@ -2993,8 +2993,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["break"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("break")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("break")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3002,8 +3002,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["break"] = arg0 var arg1 string if tmp, ok := rawArgs["default"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("default")) - arg1, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("default")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3011,8 +3011,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["default"] = arg1 var arg2 string if tmp, ok := rawArgs["func"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("func")) - arg2, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("func")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3020,8 +3020,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["func"] = arg2 var arg3 string if tmp, ok := rawArgs["interface"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("interface")) - arg3, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("interface")) + arg3, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3029,8 +3029,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["interface"] = arg3 var arg4 string if tmp, ok := rawArgs["select"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("select")) - arg4, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("select")) + arg4, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3038,8 +3038,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["select"] = arg4 var arg5 string if tmp, ok := rawArgs["case"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("case")) - arg5, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("case")) + arg5, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3047,8 +3047,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["case"] = arg5 var arg6 string if tmp, ok := rawArgs["defer"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("defer")) - arg6, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("defer")) + arg6, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3056,8 +3056,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["defer"] = arg6 var arg7 string if tmp, ok := rawArgs["go"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("go")) - arg7, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("go")) + arg7, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3065,8 +3065,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["go"] = arg7 var arg8 string if tmp, ok := rawArgs["map"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) - arg8, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) + arg8, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3074,8 +3074,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["map"] = arg8 var arg9 string if tmp, ok := rawArgs["struct"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("struct")) - arg9, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("struct")) + arg9, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3083,8 +3083,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["struct"] = arg9 var arg10 string if tmp, ok := rawArgs["chan"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("chan")) - arg10, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("chan")) + arg10, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3092,8 +3092,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["chan"] = arg10 var arg11 string if tmp, ok := rawArgs["else"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("else")) - arg11, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("else")) + arg11, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3101,8 +3101,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["else"] = arg11 var arg12 string if tmp, ok := rawArgs["goto"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("goto")) - arg12, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("goto")) + arg12, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3110,8 +3110,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["goto"] = arg12 var arg13 string if tmp, ok := rawArgs["package"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("package")) - arg13, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("package")) + arg13, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3119,8 +3119,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["package"] = arg13 var arg14 string if tmp, ok := rawArgs["switch"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("switch")) - arg14, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("switch")) + arg14, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3128,8 +3128,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["switch"] = arg14 var arg15 string if tmp, ok := rawArgs["const"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("const")) - arg15, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("const")) + arg15, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3137,8 +3137,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["const"] = arg15 var arg16 string if tmp, ok := rawArgs["fallthrough"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("fallthrough")) - arg16, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("fallthrough")) + arg16, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3146,8 +3146,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["fallthrough"] = arg16 var arg17 string if tmp, ok := rawArgs["if"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("if")) - arg17, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("if")) + arg17, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3155,8 +3155,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["if"] = arg17 var arg18 string if tmp, ok := rawArgs["range"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("range")) - arg18, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("range")) + arg18, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3164,8 +3164,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["range"] = arg18 var arg19 string if tmp, ok := rawArgs["type"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) - arg19, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) + arg19, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3173,8 +3173,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["type"] = arg19 var arg20 string if tmp, ok := rawArgs["continue"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("continue")) - arg20, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("continue")) + arg20, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3182,8 +3182,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["continue"] = arg20 var arg21 string if tmp, ok := rawArgs["for"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("for")) - arg21, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("for")) + arg21, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3191,8 +3191,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["for"] = arg21 var arg22 string if tmp, ok := rawArgs["import"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("import")) - arg22, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("import")) + arg22, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3200,8 +3200,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["import"] = arg22 var arg23 string if tmp, ok := rawArgs["return"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("return")) - arg23, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("return")) + arg23, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3209,8 +3209,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["return"] = arg23 var arg24 string if tmp, ok := rawArgs["var"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("var")) - arg24, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("var")) + arg24, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3218,8 +3218,8 @@ func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, args["var"] = arg24 var arg25 string if tmp, ok := rawArgs["_"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("_")) - arg25, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("_")) + arg25, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3233,8 +3233,8 @@ func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context. args := map[string]interface{}{} var arg0 *ValidInput if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐValidInput(ctx, tmp) if err != nil { return nil, err } @@ -3248,8 +3248,8 @@ func (ec *executionContext) field_WrappedMap_get_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["key"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("key")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("key")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -3263,8 +3263,8 @@ func (ec *executionContext) field_WrappedSlice_get_args(ctx context.Context, raw args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["idx"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("idx")) - arg0, err = ec.unmarshalNInt2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("idx")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } @@ -3278,8 +3278,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -3293,8 +3293,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -9583,8 +9583,8 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o case "message": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("message")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, v) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("message")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { @@ -9600,7 +9600,7 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o return ec.directives.Length(ctx, obj, directive0, min, nil, message) } - tmp, err := directive1(childCtx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -9624,8 +9624,8 @@ func (ec *executionContext) unmarshalInputInnerInput(ctx context.Context, obj in case "id": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - it.ID, err = ec.unmarshalNInt2int(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + it.ID, err = ec.unmarshalNInt2int(ctx, v) if err != nil { return it, err } @@ -9644,8 +9644,8 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "text": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(childCtx, v) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { @@ -9665,7 +9665,7 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o return ec.directives.Length(ctx, obj, directive0, min, max, message) } - tmp, err := directive1(childCtx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -9677,8 +9677,8 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "nullableText": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("nullableText")) - directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(childCtx, v) } + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("nullableText")) + directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { return nil, errors.New("directive toNull is not implemented") @@ -9686,7 +9686,7 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o return ec.directives.ToNull(ctx, obj, directive0) } - tmp, err := directive1(childCtx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -9700,25 +9700,25 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "inner": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("inner")) - it.Inner, err = ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("inner")) + it.Inner, err = ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx, v) if err != nil { return it, err } case "innerNullable": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("innerNullable")) - it.InnerNullable, err = ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("innerNullable")) + it.InnerNullable, err = ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerDirectives(ctx, v) if err != nil { return it, err } case "thirdParty": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("thirdParty")) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("thirdParty")) directive0 := func(ctx context.Context) (interface{}, error) { - return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(childCtx, v) + return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐThirdParty(ctx, v) } directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) @@ -9735,7 +9735,7 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o return ec.directives.Length(ctx, obj, directive0, min, max, nil) } - tmp, err := directive1(childCtx) + tmp, err := directive1(ctx) if err != nil { return it, err } @@ -9761,8 +9761,8 @@ func (ec *executionContext) unmarshalInputInputWithEnumValue(ctx context.Context case "enum": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("enum")) - it.Enum, err = ec.unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("enum")) + it.Enum, err = ec.unmarshalNEnumTest2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEnumTest(ctx, v) if err != nil { return it, err } @@ -9781,8 +9781,8 @@ func (ec *executionContext) unmarshalInputNestedInput(ctx context.Context, obj i case "field": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("field")) - it.Field, err = ec.unmarshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("field")) + it.Field, err = ec.unmarshalNEmail2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐEmail(ctx, v) if err != nil { return it, err } @@ -9801,8 +9801,8 @@ func (ec *executionContext) unmarshalInputNestedMapInput(ctx context.Context, ob case "map": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) - it.Map, err = ec.unmarshalOMapStringInterfaceInput2map(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) + it.Map, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, v) if err != nil { return it, err } @@ -9821,8 +9821,8 @@ func (ec *executionContext) unmarshalInputOuterInput(ctx context.Context, obj in case "inner": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("inner")) - it.Inner, err = ec.unmarshalNInnerInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("inner")) + it.Inner, err = ec.unmarshalNInnerInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐInnerInput(ctx, v) if err != nil { return it, err } @@ -9841,8 +9841,8 @@ func (ec *executionContext) unmarshalInputRecursiveInputSlice(ctx context.Contex case "self": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("self")) - it.Self, err = ec.unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSliceᚄ(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("self")) + it.Self, err = ec.unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSliceᚄ(ctx, v) if err != nil { return it, err } @@ -9861,8 +9861,8 @@ func (ec *executionContext) unmarshalInputSpecialInput(ctx context.Context, obj case "nesting": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("nesting")) - it.Nesting, err = ec.unmarshalNNestedInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("nesting")) + it.Nesting, err = ec.unmarshalNNestedInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐNestedInput(ctx, v) if err != nil { return it, err } @@ -9881,208 +9881,208 @@ func (ec *executionContext) unmarshalInputValidInput(ctx context.Context, obj in case "break": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("break")) - it.Break, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("break")) + it.Break, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "default": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("default")) - it.Default, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("default")) + it.Default, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "func": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("func")) - it.Func, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("func")) + it.Func, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "interface": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("interface")) - it.Interface, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("interface")) + it.Interface, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "select": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("select")) - it.Select, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("select")) + it.Select, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "case": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("case")) - it.Case, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("case")) + it.Case, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "defer": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("defer")) - it.Defer, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("defer")) + it.Defer, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "go": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("go")) - it.Go, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("go")) + it.Go, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "map": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) - it.Map, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("map")) + it.Map, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "struct": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("struct")) - it.Struct, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("struct")) + it.Struct, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "chan": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("chan")) - it.Chan, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("chan")) + it.Chan, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "else": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("else")) - it.Else, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("else")) + it.Else, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "goto": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("goto")) - it.Goto, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("goto")) + it.Goto, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "package": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("package")) - it.Package, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("package")) + it.Package, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "switch": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("switch")) - it.Switch, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("switch")) + it.Switch, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "const": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("const")) - it.Const, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("const")) + it.Const, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "fallthrough": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("fallthrough")) - it.Fallthrough, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("fallthrough")) + it.Fallthrough, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "if": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("if")) - it.If, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("if")) + it.If, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "range": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("range")) - it.Range, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("range")) + it.Range, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "type": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) - it.Type, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) + it.Type, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "continue": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("continue")) - it.Continue, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("continue")) + it.Continue, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "for": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("for")) - it.For, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("for")) + it.For, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "import": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("import")) - it.Import, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("import")) + it.Import, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "return": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("return")) - it.Return, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("return")) + it.Return, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "var": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("var")) - it.Var, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("var")) + it.Var, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "_": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("_")) - it.Underscore, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("_")) + it.Underscore, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } @@ -13133,10 +13133,10 @@ func (ec *executionContext) unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designs var err error res := make([]MarshalPanic, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNMarshalPanic2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐMarshalPanic(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -13300,10 +13300,10 @@ func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -13330,10 +13330,10 @@ func (ec *executionContext) unmarshalNString2ᚕᚖstring(ctx context.Context, v var err error res := make([]*string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalOString2ᚖstring(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -13561,10 +13561,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -14133,10 +14133,10 @@ func (ec *executionContext) unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99desig var err error res := make([][]*OuterInput, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalOOuterInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOOuterInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -14157,10 +14157,10 @@ func (ec *executionContext) unmarshalOOuterInput2ᚕᚖgithubᚗcomᚋ99designs var err error res := make([]*OuterInput, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalOOuterInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOOuterInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐOuterInput(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -14307,10 +14307,10 @@ func (ec *executionContext) unmarshalORecursiveInputSlice2ᚕgithubᚗcomᚋ99de var err error res := make([]RecursiveInputSlice, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNRecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNRecursiveInputSlice2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚐRecursiveInputSlice(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -14406,10 +14406,10 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -14442,10 +14442,10 @@ func (ec *executionContext) unmarshalOString2ᚕᚖstring(ctx context.Context, v var err error res := make([]*string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalOString2ᚖstring(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOString2ᚖstring(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/codegen/type.gotpl b/codegen/type.gotpl index b90a7899f8a..cc8b21bcafa 100644 --- a/codegen/type.gotpl +++ b/codegen/type.gotpl @@ -19,10 +19,10 @@ var err error res := make([]{{$type.GO.Elem | ref}}, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.{{ $type.Elem.UnmarshalFunc }}(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/chat/generated.go b/example/chat/generated.go index 6d82195ec78..7e7e5d2143a 100644 --- a/example/chat/generated.go +++ b/example/chat/generated.go @@ -296,8 +296,8 @@ func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[strin args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["username"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("username")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("username")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -311,8 +311,8 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["text"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -320,8 +320,8 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg args["text"] = arg0 var arg1 string if tmp, ok := rawArgs["username"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("username")) - arg1, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("username")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -329,8 +329,8 @@ func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArg args["username"] = arg1 var arg2 string if tmp, ok := rawArgs["roomName"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("roomName")) - arg2, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("roomName")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -344,8 +344,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -359,8 +359,8 @@ func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -374,8 +374,8 @@ func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Con args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["roomName"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("roomName")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("roomName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -389,8 +389,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -404,8 +404,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -2515,10 +2515,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/config/generated.go b/example/config/generated.go index 5f4d8d39513..de77bd4a5ea 100644 --- a/example/config/generated.go +++ b/example/config/generated.go @@ -264,8 +264,8 @@ func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, args := map[string]interface{}{} var arg0 NewTodo if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋconfigᚐNewTodo(ctx, tmp) if err != nil { return nil, err } @@ -279,8 +279,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -294,8 +294,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -309,8 +309,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -1773,16 +1773,16 @@ func (ec *executionContext) unmarshalInputNewTodo(ctx context.Context, obj inter case "text": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) - it.Text, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + it.Text, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "userId": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("userId")) - it.UserID, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("userId")) + it.UserID, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } @@ -2406,10 +2406,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2615,10 +2615,10 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/dataloader/generated.go b/example/dataloader/generated.go index 837d2fe7fc0..075e7397c14 100644 --- a/example/dataloader/generated.go +++ b/example/dataloader/generated.go @@ -313,8 +313,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -328,8 +328,8 @@ func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []int if tmp, ok := rawArgs["customerIds"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("customerIds")) - arg0, err = ec.unmarshalOInt2ᚕintᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("customerIds")) + arg0, err = ec.unmarshalOInt2ᚕintᚄ(ctx, tmp) if err != nil { return nil, err } @@ -343,8 +343,8 @@ func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 [][]int if tmp, ok := rawArgs["customerIds"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("customerIds")) - arg0, err = ec.unmarshalOInt2ᚕᚕint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("customerIds")) + arg0, err = ec.unmarshalOInt2ᚕᚕint(ctx, tmp) if err != nil { return nil, err } @@ -358,8 +358,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -373,8 +373,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -2688,10 +2688,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2979,10 +2979,10 @@ func (ec *executionContext) unmarshalOInt2ᚕintᚄ(ctx context.Context, v inter var err error res := make([]int, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNInt2int(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNInt2int(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -3015,10 +3015,10 @@ func (ec *executionContext) unmarshalOInt2ᚕᚕint(ctx context.Context, v inter var err error res := make([][]int, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalOInt2ᚕintᚄ(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalOInt2ᚕintᚄ(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/federation/accounts/graph/generated/generated.go b/example/federation/accounts/graph/generated/generated.go index f89e0115db7..810ef99a9d5 100644 --- a/example/federation/accounts/graph/generated/generated.go +++ b/example/federation/accounts/graph/generated/generated.go @@ -246,8 +246,8 @@ func (ec *executionContext) field_Entity_findUserByID_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -261,8 +261,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -276,8 +276,8 @@ func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []map[string]interface{} if tmp, ok := rawArgs["representations"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) - arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) if err != nil { return nil, err } @@ -291,8 +291,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -306,8 +306,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -2220,10 +2220,10 @@ func (ec *executionContext) unmarshalN_Any2ᚕmapᚄ(ctx context.Context, v inte var err error res := make([]map[string]interface{}, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN_Any2map(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN_Any2map(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2362,10 +2362,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/federation/products/graph/generated/generated.go b/example/federation/products/graph/generated/generated.go index 6bf501d048a..3d0a390d1e2 100644 --- a/example/federation/products/graph/generated/generated.go +++ b/example/federation/products/graph/generated/generated.go @@ -260,8 +260,8 @@ func (ec *executionContext) field_Entity_findProductByUpc_args(ctx context.Conte args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["upc"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("upc")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("upc")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -275,8 +275,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -290,8 +290,8 @@ func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []map[string]interface{} if tmp, ok := rawArgs["representations"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) - arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) if err != nil { return nil, err } @@ -305,8 +305,8 @@ func (ec *executionContext) field_Query_topProducts_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["first"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) - arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -320,8 +320,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -335,8 +335,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -2295,10 +2295,10 @@ func (ec *executionContext) unmarshalN_Any2ᚕmapᚄ(ctx context.Context, v inte var err error res := make([]map[string]interface{}, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN_Any2map(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN_Any2map(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2437,10 +2437,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/federation/reviews/graph/generated/generated.go b/example/federation/reviews/graph/generated/generated.go index bc86c050528..a339df5b37d 100644 --- a/example/federation/reviews/graph/generated/generated.go +++ b/example/federation/reviews/graph/generated/generated.go @@ -310,8 +310,8 @@ func (ec *executionContext) field_Entity_findProductByUpc_args(ctx context.Conte args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["upc"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("upc")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("upc")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -325,8 +325,8 @@ func (ec *executionContext) field_Entity_findUserByID_args(ctx context.Context, args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -340,8 +340,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -355,8 +355,8 @@ func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 []map[string]interface{} if tmp, ok := rawArgs["representations"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) - arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) if err != nil { return nil, err } @@ -370,8 +370,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -385,8 +385,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -2578,10 +2578,10 @@ func (ec *executionContext) unmarshalN_Any2ᚕmapᚄ(ctx context.Context, v inte var err error res := make([]map[string]interface{}, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN_Any2map(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN_Any2map(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2720,10 +2720,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/fileupload/generated.go b/example/fileupload/generated.go index 8e63b14764d..64f6653a259 100644 --- a/example/fileupload/generated.go +++ b/example/fileupload/generated.go @@ -277,8 +277,8 @@ func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx co args := map[string]interface{}{} var arg0 []*model.UploadFile if tmp, ok := rawArgs["req"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("req")) - arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFileᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("req")) + arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFileᚄ(ctx, tmp) if err != nil { return nil, err } @@ -292,8 +292,8 @@ func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Conte args := map[string]interface{}{} var arg0 []*graphql.Upload if tmp, ok := rawArgs["files"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("files")) - arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUploadᚄ(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("files")) + arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUploadᚄ(ctx, tmp) if err != nil { return nil, err } @@ -307,8 +307,8 @@ func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx cont args := map[string]interface{}{} var arg0 model.UploadFile if tmp, ok := rawArgs["req"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("req")) - arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("req")) + arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) if err != nil { return nil, err } @@ -322,8 +322,8 @@ func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context args := map[string]interface{}{} var arg0 graphql.Upload if tmp, ok := rawArgs["file"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("file")) - arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("file")) + arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) if err != nil { return nil, err } @@ -337,8 +337,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -352,8 +352,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -367,8 +367,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -1852,16 +1852,16 @@ func (ec *executionContext) unmarshalInputUploadFile(ctx context.Context, obj in case "id": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - it.ID, err = ec.unmarshalNInt2int(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + it.ID, err = ec.unmarshalNInt2int(ctx, v) if err != nil { return it, err } case "file": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("file")) - it.File, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("file")) + it.File, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, v) if err != nil { return it, err } @@ -2379,10 +2379,10 @@ func (ec *executionContext) unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgq var err error res := make([]*graphql.Upload, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2429,10 +2429,10 @@ func (ec *executionContext) unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designs var err error res := make([]*model.UploadFile, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNUploadFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNUploadFile2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋfileuploadᚋmodelᚐUploadFile(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2511,10 +2511,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/scalars/generated.go b/example/scalars/generated.go index cad3030522a..a6d0034fa6e 100644 --- a/example/scalars/generated.go +++ b/example/scalars/generated.go @@ -284,8 +284,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -299,8 +299,8 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 *model.SearchArgs if tmp, ok := rawArgs["input"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) - arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("input")) + arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐSearchArgs(ctx, tmp) if err != nil { return nil, err } @@ -314,8 +314,8 @@ func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 external.ObjectID if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋexternalᚐObjectID(ctx, tmp) if err != nil { return nil, err } @@ -329,8 +329,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -344,8 +344,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -1902,24 +1902,24 @@ func (ec *executionContext) unmarshalInputSearchArgs(ctx context.Context, obj in case "location": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("location")) - it.Location, err = ec.unmarshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("location")) + it.Location, err = ec.unmarshalOPoint2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐPoint(ctx, v) if err != nil { return it, err } case "createdAfter": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("createdAfter")) - it.CreatedAfter, err = ec.unmarshalOTimestamp2ᚖtimeᚐTime(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("createdAfter")) + it.CreatedAfter, err = ec.unmarshalOTimestamp2ᚖtimeᚐTime(ctx, v) if err != nil { return it, err } case "isBanned": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("isBanned")) - it.IsBanned, err = ec.unmarshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("isBanned")) + it.IsBanned, err = ec.unmarshalOBanned2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋscalarsᚋmodelᚐBanned(ctx, v) if err != nil { return it, err } @@ -2536,10 +2536,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/selection/generated.go b/example/selection/generated.go index 187985edca2..e4da3adca59 100644 --- a/example/selection/generated.go +++ b/example/selection/generated.go @@ -230,8 +230,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -245,8 +245,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -260,8 +260,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -2205,10 +2205,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2454,10 +2454,10 @@ func (ec *executionContext) unmarshalOString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/starwars/generated/exec.go b/example/starwars/generated/exec.go index 697d32ab201..69a6ca11937 100644 --- a/example/starwars/generated/exec.go +++ b/example/starwars/generated/exec.go @@ -694,8 +694,8 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["first"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) - arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -703,8 +703,8 @@ func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Conte args["first"] = arg0 var arg1 *string if tmp, ok := rawArgs["after"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("after")) - arg1, err = ec.unmarshalOID2ᚖstring(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("after")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err } @@ -718,8 +718,8 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["first"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) - arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -727,8 +727,8 @@ func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Conte args["first"] = arg0 var arg1 *string if tmp, ok := rawArgs["after"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("after")) - arg1, err = ec.unmarshalOID2ᚖstring(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("after")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) if err != nil { return nil, err } @@ -742,8 +742,8 @@ func (ec *executionContext) field_Human_height_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 models.LengthUnit if tmp, ok := rawArgs["unit"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("unit")) - arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("unit")) + arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) if err != nil { return nil, err } @@ -757,8 +757,8 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context args := map[string]interface{}{} var arg0 models.Episode if tmp, ok := rawArgs["episode"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) - arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) + arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err } @@ -766,8 +766,8 @@ func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context args["episode"] = arg0 var arg1 models.Review if tmp, ok := rawArgs["review"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("review")) - arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("review")) + arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐReview(ctx, tmp) if err != nil { return nil, err } @@ -781,8 +781,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -796,8 +796,8 @@ func (ec *executionContext) field_Query_character_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -811,8 +811,8 @@ func (ec *executionContext) field_Query_droid_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -826,8 +826,8 @@ func (ec *executionContext) field_Query_hero_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 *models.Episode if tmp, ok := rawArgs["episode"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) - arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) + arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err } @@ -841,8 +841,8 @@ func (ec *executionContext) field_Query_human_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -856,8 +856,8 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 models.Episode if tmp, ok := rawArgs["episode"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) - arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("episode")) + arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) if err != nil { return nil, err } @@ -865,8 +865,8 @@ func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArg args["episode"] = arg0 var arg1 *time.Time if tmp, ok := rawArgs["since"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("since")) - arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("since")) + arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) if err != nil { return nil, err } @@ -880,8 +880,8 @@ func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["text"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -895,8 +895,8 @@ func (ec *executionContext) field_Query_starship_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -910,8 +910,8 @@ func (ec *executionContext) field_Starship_length_args(ctx context.Context, rawA args := map[string]interface{}{} var arg0 *models.LengthUnit if tmp, ok := rawArgs["unit"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("unit")) - arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("unit")) + arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) if err != nil { return nil, err } @@ -925,8 +925,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -940,8 +940,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -3419,24 +3419,24 @@ func (ec *executionContext) unmarshalInputReviewInput(ctx context.Context, obj i case "stars": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("stars")) - it.Stars, err = ec.unmarshalNInt2int(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("stars")) + it.Stars, err = ec.unmarshalNInt2int(ctx, v) if err != nil { return it, err } case "commentary": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("commentary")) - it.Commentary, err = ec.unmarshalOString2ᚖstring(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("commentary")) + it.Commentary, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } case "time": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("time")) - it.Time, err = ec.unmarshalOTime2timeᚐTime(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("time")) + it.Time, err = ec.unmarshalOTime2timeᚐTime(ctx, v) if err != nil { return it, err } @@ -4286,10 +4286,10 @@ func (ec *executionContext) unmarshalNEpisode2ᚕgithubᚗcomᚋ99designsᚋgqlg var err error res := make([]models.Episode, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋstarwarsᚋmodelsᚐEpisode(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -4417,10 +4417,10 @@ func (ec *executionContext) unmarshalNInt2ᚕintᚄ(ctx context.Context, v inter var err error res := make([]int, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNInt2int(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNInt2int(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -4447,10 +4447,10 @@ func (ec *executionContext) unmarshalNInt2ᚕᚕintᚄ(ctx context.Context, v in var err error res := make([][]int, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNInt2ᚕintᚄ(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNInt2ᚕintᚄ(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -4669,10 +4669,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/todo/generated.go b/example/todo/generated.go index 96c4f529893..b76a4a54957 100644 --- a/example/todo/generated.go +++ b/example/todo/generated.go @@ -280,8 +280,8 @@ func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[st args := map[string]interface{}{} var arg0 Role if tmp, ok := rawArgs["role"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("role")) - arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("role")) + arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐRole(ctx, tmp) if err != nil { return nil, err } @@ -295,8 +295,8 @@ func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[strin args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err } @@ -310,8 +310,8 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context args := map[string]interface{}{} var arg0 TodoInput if tmp, ok := rawArgs["todo"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("todo")) - arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("todo")) + arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtodoᚐTodoInput(ctx, tmp) if err != nil { return nil, err } @@ -325,8 +325,8 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err } @@ -334,8 +334,8 @@ func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context args["id"] = arg0 var arg1 map[string]interface{} if tmp, ok := rawArgs["changes"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("changes")) - arg1, err = ec.unmarshalNMap2map(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("changes")) + arg1, err = ec.unmarshalNMap2map(ctx, tmp) if err != nil { return nil, err } @@ -349,8 +349,8 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -364,8 +364,8 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) if err != nil { return nil, err } @@ -379,8 +379,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -394,8 +394,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -1821,16 +1821,16 @@ func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj int case "text": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) - it.Text, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + it.Text, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "done": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("done")) - it.Done, err = ec.unmarshalOBoolean2ᚖbool(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("done")) + it.Done, err = ec.unmarshalOBoolean2ᚖbool(ctx, v) if err != nil { return it, err } @@ -2429,10 +2429,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/example/type-system-extension/generated.go b/example/type-system-extension/generated.go index 8cf846bda0f..089b18ff3d2 100644 --- a/example/type-system-extension/generated.go +++ b/example/type-system-extension/generated.go @@ -300,8 +300,8 @@ func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context args := map[string]interface{}{} var arg0 TodoInput if tmp, ok := rawArgs["todo"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("todo")) - arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("todo")) + arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋexampleᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx, tmp) if err != nil { return nil, err } @@ -315,8 +315,8 @@ func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawAr args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -330,8 +330,8 @@ func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["id"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) - arg0, err = ec.unmarshalNID2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) if err != nil { return nil, err } @@ -345,8 +345,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -360,8 +360,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -1780,8 +1780,8 @@ func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj int case "text": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) - it.Text, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("text")) + it.Text, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } @@ -2383,10 +2383,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil diff --git a/integration/generated.go b/integration/generated.go index 362286bdc5d..4adb4c661c6 100644 --- a/integration/generated.go +++ b/integration/generated.go @@ -316,8 +316,8 @@ func (ec *executionContext) dir_magic_args(ctx context.Context, rawArgs map[stri args := map[string]interface{}{} var arg0 *int if tmp, ok := rawArgs["kind"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("kind")) - arg0, err = ec.unmarshalOInt2ᚖint(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("kind")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) if err != nil { return nil, err } @@ -331,8 +331,8 @@ func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 string if tmp, ok := rawArgs["name"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) - arg0, err = ec.unmarshalNString2string(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) if err != nil { return nil, err } @@ -346,8 +346,8 @@ func (ec *executionContext) field_Query_complexity_args(ctx context.Context, raw args := map[string]interface{}{} var arg0 int if tmp, ok := rawArgs["value"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("value")) - arg0, err = ec.unmarshalNInt2int(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("value")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) if err != nil { return nil, err } @@ -361,8 +361,8 @@ func (ec *executionContext) field_Query_date_args(ctx context.Context, rawArgs m args := map[string]interface{}{} var arg0 models.DateFilter if tmp, ok := rawArgs["filter"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("filter")) - arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("filter")) + arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilter(ctx, tmp) if err != nil { return nil, err } @@ -376,8 +376,8 @@ func (ec *executionContext) field_Query_error_args(ctx context.Context, rawArgs args := map[string]interface{}{} var arg0 *models.ErrorType if tmp, ok := rawArgs["type"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) - arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("type")) + arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐErrorType(ctx, tmp) if err != nil { return nil, err } @@ -391,8 +391,8 @@ func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, ra args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -406,8 +406,8 @@ func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArg args := map[string]interface{}{} var arg0 bool if tmp, ok := rawArgs["includeDeprecated"]; ok { - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) - arg0, err = ec.unmarshalOBoolean2bool(childCtx, tmp) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) if err != nil { return nil, err } @@ -1981,24 +1981,24 @@ func (ec *executionContext) unmarshalInputDateFilter(ctx context.Context, obj in case "value": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("value")) - it.Value, err = ec.unmarshalNString2string(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("value")) + it.Value, err = ec.unmarshalNString2string(ctx, v) if err != nil { return it, err } case "timezone": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("timezone")) - it.Timezone, err = ec.unmarshalOString2ᚖstring(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("timezone")) + it.Timezone, err = ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } case "op": var err error - childCtx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("op")) - it.Op, err = ec.unmarshalODATE_FILTER_OP2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(childCtx, v) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithField("op")) + it.Op, err = ec.unmarshalODATE_FILTER_OP2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋmodelsᚑgoᚐDateFilterOp(ctx, v) if err != nil { return it, err } @@ -2571,10 +2571,10 @@ func (ec *executionContext) unmarshalNString2ᚕstringᚄ(ctx context.Context, v var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNString2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNString2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2657,10 +2657,10 @@ func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx conte var err error res := make([]string, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil @@ -2842,10 +2842,10 @@ func (ec *executionContext) unmarshalOBoolean2ᚕboolᚄ(ctx context.Context, v var err error res := make([]bool, len(vSlice)) for i := range vSlice { - nctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) - res[i], err = ec.unmarshalNBoolean2bool(nctx, vSlice[i]) + ctx := graphql.WithFieldInputContext(ctx, graphql.NewFieldInputWithIndex(i)) + res[i], err = ec.unmarshalNBoolean2bool(ctx, vSlice[i]) if err != nil { - return nil, graphql.WrapErrorWithInputPath(nctx, err) + return nil, graphql.WrapErrorWithInputPath(ctx, err) } } return res, nil