From b180b46b662d1754c9342fb9a9628e7e3ddb0352 Mon Sep 17 00:00:00 2001 From: Steve Coffman Date: Mon, 22 Jul 2024 16:29:06 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"feat:=20allow=20argument=20directives?= =?UTF-8?q?=20to=20be=20called=20even=20if=20the=20argument=20is=20?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0fb31a3ed2a63552eddcf7c2a6c40aa0d59bd4cc. --- _examples/chat/generated.go | 281 +- _examples/config/generated.go | 124 +- _examples/dataloader/generated.go | 155 +- .../embedding/subdir/gendir/generated.go | 93 +- .../embedding/subdir/prelude.generated.go | 125 +- _examples/embedding/subdir/root.generated.go | 31 +- _examples/enum/api/exec.go | 558 +-- .../federation/accounts/graph/generated.go | 186 +- .../federation/products/graph/generated.go | 280 +- .../federation/reviews/graph/generated.go | 218 +- _examples/fileupload/generated.go | 217 +- _examples/scalars/generated.go | 218 +- _examples/selection/generated.go | 93 +- _examples/starwars/generated/exec.go | 593 +--- _examples/todo/generated.go | 287 +- _examples/type-system-extension/generated.go | 175 +- codegen/args.go | 24 +- codegen/args.gotpl | 64 +- codegen/config/config.go | 66 +- codegen/directives.gotpl | 10 +- .../followschema/defaults.generated.go | 124 +- .../followschema/directive.generated.go | 358 +- .../testserver/followschema/directive.graphql | 5 - .../testserver/followschema/directive_test.go | 50 - .../followschema/panics.generated.go | 62 +- .../followschema/prelude.generated.go | 62 +- codegen/testserver/followschema/resolver.go | 5 - .../followschema/root_.generated.go | 15 - .../followschema/schema.generated.go | 1598 +++------ codegen/testserver/followschema/stub.go | 4 - .../followschema/validtypes.generated.go | 862 ++--- .../followschema/variadic.generated.go | 31 +- .../followschema/wrapped_type.generated.go | 62 +- .../nullabledirectives/directive.graphql | 8 - .../nullabledirectives/directive_test.go | 75 - .../generated/directive.generated.go | 416 --- .../generated/models/models-gen.go | 6 - .../generated/prelude.generated.go | 2771 --------------- .../generated/resolvers/resolver.go | 21 - .../generated/root_.generated.go | 179 - .../testserver/nullabledirectives/gqlgen.yml | 16 - codegen/testserver/nullabledirectives/stub.go | 25 - codegen/testserver/singlefile/generated.go | 2985 ++++------------- docs/content/config.md | 10 - integration/server/generated.go | 248 +- .../testdata/entityresolver/generated/exec.go | 751 +---- .../explicitrequires/generated/exec.go | 751 +---- 47 files changed, 2749 insertions(+), 12549 deletions(-) delete mode 100644 codegen/testserver/nullabledirectives/directive.graphql delete mode 100644 codegen/testserver/nullabledirectives/directive_test.go delete mode 100644 codegen/testserver/nullabledirectives/generated/directive.generated.go delete mode 100644 codegen/testserver/nullabledirectives/generated/models/models-gen.go delete mode 100644 codegen/testserver/nullabledirectives/generated/prelude.generated.go delete mode 100644 codegen/testserver/nullabledirectives/generated/resolvers/resolver.go delete mode 100644 codegen/testserver/nullabledirectives/generated/root_.generated.go delete mode 100644 codegen/testserver/nullabledirectives/gqlgen.yml delete mode 100644 codegen/testserver/nullabledirectives/stub.go diff --git a/_examples/chat/generated.go b/_examples/chat/generated.go index 18cc9fdee69..0d02f08048e 100644 --- a/_examples/chat/generated.go +++ b/_examples/chat/generated.go @@ -343,280 +343,125 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_user_argsUsername(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["username"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["username"] = arg0 return args, nil } -func (ec *executionContext) dir_user_argsUsername( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["username"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - if tmp, ok := rawArgs["username"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Mutation_post_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_post_argsText(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["text"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["text"] = arg0 - arg1, err := ec.field_Mutation_post_argsUsername(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["username"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["username"] = arg1 - arg2, err := ec.field_Mutation_post_argsRoomName(ctx, rawArgs) - if err != nil { - return nil, err + var arg2 string + if tmp, ok := rawArgs["roomName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roomName")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["roomName"] = arg2 return args, nil } -func (ec *executionContext) field_Mutation_post_argsText( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["text"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) - if tmp, ok := rawArgs["text"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Mutation_post_argsUsername( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["username"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("username")) - if tmp, ok := rawArgs["username"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Mutation_post_argsRoomName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["roomName"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("roomName")) - if tmp, ok := rawArgs["roomName"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_room_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_room_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query_room_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Subscription_messageAdded_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Subscription_messageAdded_argsRoomName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["roomName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("roomName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["roomName"] = arg0 return args, nil } -func (ec *executionContext) field_Subscription_messageAdded_argsRoomName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["roomName"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("roomName")) - if tmp, ok := rawArgs["roomName"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/config/generated.go b/_examples/config/generated.go index b5b12d648b9..ab5824411ba 100644 --- a/_examples/config/generated.go +++ b/_examples/config/generated.go @@ -335,130 +335,62 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Mutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_createTodo_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 NewTodo + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋconfigᚐNewTodo(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_createTodo_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (NewTodo, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal NewTodo - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNNewTodo2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋconfigᚐNewTodo(ctx, tmp) - } - - var zeroVal NewTodo - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/dataloader/generated.go b/_examples/dataloader/generated.go index 1f26b7a3ce1..d89705213ff 100644 --- a/_examples/dataloader/generated.go +++ b/_examples/dataloader/generated.go @@ -337,162 +337,77 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_torture1d_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_torture1d_argsCustomerIds(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []int + if tmp, ok := rawArgs["customerIds"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("customerIds")) + arg0, err = ec.unmarshalOInt2ᚕintᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["customerIds"] = arg0 return args, nil } -func (ec *executionContext) field_Query_torture1d_argsCustomerIds( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["customerIds"] - if !ok { - var zeroVal []int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("customerIds")) - if tmp, ok := rawArgs["customerIds"]; ok { - return ec.unmarshalOInt2ᚕintᚄ(ctx, tmp) - } - - var zeroVal []int - return zeroVal, nil -} func (ec *executionContext) field_Query_torture2d_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_torture2d_argsCustomerIds(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 [][]int + if tmp, ok := rawArgs["customerIds"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("customerIds")) + arg0, err = ec.unmarshalOInt2ᚕᚕint(ctx, tmp) + if err != nil { + return nil, err + } } args["customerIds"] = arg0 return args, nil } -func (ec *executionContext) field_Query_torture2d_argsCustomerIds( - ctx context.Context, - rawArgs map[string]interface{}, -) ([][]int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["customerIds"] - if !ok { - var zeroVal [][]int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("customerIds")) - if tmp, ok := rawArgs["customerIds"]; ok { - return ec.unmarshalOInt2ᚕᚕint(ctx, tmp) - } - - var zeroVal [][]int - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/embedding/subdir/gendir/generated.go b/_examples/embedding/subdir/gendir/generated.go index 91b85c97180..34ebc636eb6 100644 --- a/_examples/embedding/subdir/gendir/generated.go +++ b/_examples/embedding/subdir/gendir/generated.go @@ -246,98 +246,47 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/embedding/subdir/prelude.generated.go b/_examples/embedding/subdir/prelude.generated.go index c18200dbc90..947555449fb 100644 --- a/_examples/embedding/subdir/prelude.generated.go +++ b/_examples/embedding/subdir/prelude.generated.go @@ -24,125 +24,56 @@ import ( func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["if"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["if"] = arg0 - arg1, err := ec.dir_defer_argsLabel(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *string + if tmp, ok := rawArgs["label"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["label"] = arg1 return args, nil } -func (ec *executionContext) dir_defer_argsIf( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["if"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - if tmp, ok := rawArgs["if"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} - -func (ec *executionContext) dir_defer_argsLabel( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["label"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) - if tmp, ok := rawArgs["label"]; ok { - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/embedding/subdir/root.generated.go b/_examples/embedding/subdir/root.generated.go index 2a12c745c7b..06631058162 100644 --- a/_examples/embedding/subdir/root.generated.go +++ b/_examples/embedding/subdir/root.generated.go @@ -30,34 +30,17 @@ type QueryResolver interface { func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/enum/api/exec.go b/_examples/enum/api/exec.go index a097efee4ca..480aaf5fefb 100644 --- a/_examples/enum/api/exec.go +++ b/_examples/enum/api/exec.go @@ -456,578 +456,272 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_boolTypedN_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_boolTypedN_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *model.BoolTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOBoolTyped2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐBoolTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_boolTypedN_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*model.BoolTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *model.BoolTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOBoolTyped2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐBoolTyped(ctx, tmp) - } - - var zeroVal *model.BoolTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_boolTyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_boolTyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 model.BoolTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNBoolTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐBoolTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_boolTyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (model.BoolTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal model.BoolTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNBoolTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐBoolTyped(ctx, tmp) - } - - var zeroVal model.BoolTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_boolUntypedN_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_boolUntypedN_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOBoolUntyped2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_boolUntypedN_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOBoolUntyped2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} func (ec *executionContext) field_Query_boolUntyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_boolUntyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNBoolUntyped2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_boolUntyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNBoolUntyped2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field_Query_inPackage_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_inPackage_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 InPackage + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNInPackage2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋapiᚐInPackage(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_inPackage_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (InPackage, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal InPackage - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNInPackage2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋapiᚐInPackage(ctx, tmp) - } - - var zeroVal InPackage - return zeroVal, nil -} func (ec *executionContext) field_Query_intTypedN_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_intTypedN_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *model.IntTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOIntTyped2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐIntTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_intTypedN_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*model.IntTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *model.IntTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOIntTyped2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐIntTyped(ctx, tmp) - } - - var zeroVal *model.IntTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_intTyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_intTyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 model.IntTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNIntTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐIntTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_intTyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (model.IntTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal model.IntTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNIntTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐIntTyped(ctx, tmp) - } - - var zeroVal model.IntTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_intUntypedN_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_intUntypedN_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOIntUntyped2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_intUntypedN_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOIntUntyped2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Query_intUntyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_intUntyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNIntUntyped2int(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_intUntyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNIntUntyped2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_Query_stringTypedN_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_stringTypedN_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *model.StringTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOStringTyped2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐStringTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_stringTypedN_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*model.StringTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *model.StringTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOStringTyped2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐStringTyped(ctx, tmp) - } - - var zeroVal *model.StringTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_stringTyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_stringTyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 model.StringTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNStringTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐStringTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_stringTyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (model.StringTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal model.StringTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNStringTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐStringTyped(ctx, tmp) - } - - var zeroVal model.StringTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_stringUntypedN_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_stringUntypedN_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOStringUntyped2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_stringUntypedN_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOStringUntyped2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) field_Query_stringUntyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_stringUntyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNStringUntyped2string(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_stringUntyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNStringUntyped2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_varTyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_varTyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 model.VarTyped + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNVarTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐVarTyped(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_varTyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (model.VarTyped, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal model.VarTyped - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNVarTyped2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋenumᚋmodelᚐVarTyped(ctx, tmp) - } - - var zeroVal model.VarTyped - return zeroVal, nil -} func (ec *executionContext) field_Query_varUntyped_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_varUntyped_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNVarUntyped2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_varUntyped_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNVarUntyped2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/federation/accounts/graph/generated.go b/_examples/federation/accounts/graph/generated.go index 88f4a20d361..1ac71034fdb 100644 --- a/_examples/federation/accounts/graph/generated.go +++ b/_examples/federation/accounts/graph/generated.go @@ -345,194 +345,92 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Entity_findEmailHostByID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findEmailHostByID_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findEmailHostByID_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findUserByID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findUserByID_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findUserByID_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []map[string]interface{} + if tmp, ok := rawArgs["representations"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["representations"] = arg0 return args, nil } -func (ec *executionContext) field_Query__entities_argsRepresentations( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["representations"] - if !ok { - var zeroVal []map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) - if tmp, ok := rawArgs["representations"]; ok { - return ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) - } - - var zeroVal []map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/federation/products/graph/generated.go b/_examples/federation/products/graph/generated.go index e27edb57bab..848a8e8d679 100644 --- a/_examples/federation/products/graph/generated.go +++ b/_examples/federation/products/graph/generated.go @@ -369,285 +369,131 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Entity_findManufacturerByID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManufacturerByID_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManufacturerByID_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findProductByManufacturerIDAndID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findProductByManufacturerIDAndID_argsManufacturerID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["manufacturerID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("manufacturerID")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["manufacturerID"] = arg0 - arg1, err := ec.field_Entity_findProductByManufacturerIDAndID_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findProductByManufacturerIDAndID_argsManufacturerID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["manufacturerID"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("manufacturerID")) - if tmp, ok := rawArgs["manufacturerID"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findProductByManufacturerIDAndID_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findProductByUpc_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findProductByUpc_argsUpc(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["upc"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("upc")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["upc"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findProductByUpc_argsUpc( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["upc"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("upc")) - if tmp, ok := rawArgs["upc"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []map[string]interface{} + if tmp, ok := rawArgs["representations"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["representations"] = arg0 return args, nil } -func (ec *executionContext) field_Query__entities_argsRepresentations( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["representations"] - if !ok { - var zeroVal []map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) - if tmp, ok := rawArgs["representations"]; ok { - return ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) - } - - var zeroVal []map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field_Query_topProducts_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_topProducts_argsFirst(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["first"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["first"] = arg0 return args, nil } -func (ec *executionContext) field_Query_topProducts_argsFirst( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["first"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) - if tmp, ok := rawArgs["first"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/federation/reviews/graph/generated.go b/_examples/federation/reviews/graph/generated.go index dd67da8319f..f77205bbc99 100644 --- a/_examples/federation/reviews/graph/generated.go +++ b/_examples/federation/reviews/graph/generated.go @@ -399,221 +399,101 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Entity_findProductByManufacturerIDAndID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findProductByManufacturerIDAndID_argsManufacturerID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["manufacturerID"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("manufacturerID")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["manufacturerID"] = arg0 - arg1, err := ec.field_Entity_findProductByManufacturerIDAndID_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findProductByManufacturerIDAndID_argsManufacturerID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["manufacturerID"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("manufacturerID")) - if tmp, ok := rawArgs["manufacturerID"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findProductByManufacturerIDAndID_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findUserByID_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findUserByID_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findUserByID_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []map[string]interface{} + if tmp, ok := rawArgs["representations"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["representations"] = arg0 return args, nil } -func (ec *executionContext) field_Query__entities_argsRepresentations( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["representations"] - if !ok { - var zeroVal []map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) - if tmp, ok := rawArgs["representations"]; ok { - return ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) - } - - var zeroVal []map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/fileupload/generated.go b/_examples/fileupload/generated.go index 2f1f1685d62..1260313392a 100644 --- a/_examples/fileupload/generated.go +++ b/_examples/fileupload/generated.go @@ -306,226 +306,107 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Mutation_multipleUploadWithPayload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_multipleUploadWithPayload_argsReq(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*model.UploadFile + if tmp, ok := rawArgs["req"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("req")) + arg0, err = ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋfileuploadᚋmodelᚐUploadFileᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["req"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_multipleUploadWithPayload_argsReq( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*model.UploadFile, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["req"] - if !ok { - var zeroVal []*model.UploadFile - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("req")) - if tmp, ok := rawArgs["req"]; ok { - return ec.unmarshalNUploadFile2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋfileuploadᚋmodelᚐUploadFileᚄ(ctx, tmp) - } - - var zeroVal []*model.UploadFile - return zeroVal, nil -} func (ec *executionContext) field_Mutation_multipleUpload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_multipleUpload_argsFiles(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*graphql.Upload + if tmp, ok := rawArgs["files"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("files")) + arg0, err = ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUploadᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["files"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_multipleUpload_argsFiles( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*graphql.Upload, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["files"] - if !ok { - var zeroVal []*graphql.Upload - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("files")) - if tmp, ok := rawArgs["files"]; ok { - return ec.unmarshalNUpload2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUploadᚄ(ctx, tmp) - } - - var zeroVal []*graphql.Upload - return zeroVal, nil -} func (ec *executionContext) field_Mutation_singleUploadWithPayload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_singleUploadWithPayload_argsReq(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 model.UploadFile + if tmp, ok := rawArgs["req"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("req")) + arg0, err = ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) + if err != nil { + return nil, err + } } args["req"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_singleUploadWithPayload_argsReq( - ctx context.Context, - rawArgs map[string]interface{}, -) (model.UploadFile, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["req"] - if !ok { - var zeroVal model.UploadFile - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("req")) - if tmp, ok := rawArgs["req"]; ok { - return ec.unmarshalNUploadFile2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋfileuploadᚋmodelᚐUploadFile(ctx, tmp) - } - - var zeroVal model.UploadFile - return zeroVal, nil -} func (ec *executionContext) field_Mutation_singleUpload_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_singleUpload_argsFile(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 graphql.Upload + if tmp, ok := rawArgs["file"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("file")) + arg0, err = ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) + if err != nil { + return nil, err + } } args["file"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_singleUpload_argsFile( - ctx context.Context, - rawArgs map[string]interface{}, -) (graphql.Upload, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["file"] - if !ok { - var zeroVal graphql.Upload - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("file")) - if tmp, ok := rawArgs["file"]; ok { - return ec.unmarshalNUpload2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx, tmp) - } - - var zeroVal graphql.Upload - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/scalars/generated.go b/_examples/scalars/generated.go index bdb9e06fd65..9bdd3352567 100644 --- a/_examples/scalars/generated.go +++ b/_examples/scalars/generated.go @@ -344,221 +344,101 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_search_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *model.SearchArgs + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋmodelᚐSearchArgs(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_search_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*model.SearchArgs, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *model.SearchArgs - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOSearchArgs2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋmodelᚐSearchArgs(ctx, tmp) - } - - var zeroVal *model.SearchArgs - return zeroVal, nil -} func (ec *executionContext) field_Query_userByTier_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_userByTier_argsTier(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 model.Tier + if tmp, ok := rawArgs["tier"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("tier")) + arg0, err = ec.unmarshalNTier2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋmodelᚐTier(ctx, tmp) + if err != nil { + return nil, err + } } args["tier"] = arg0 - arg1, err := ec.field_Query_userByTier_argsDarkMode(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *model.Prefs + if tmp, ok := rawArgs["darkMode"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("darkMode")) + arg1, err = ec.unmarshalNDarkMode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋmodelᚐPrefs(ctx, tmp) + if err != nil { + return nil, err + } } args["darkMode"] = arg1 return args, nil } -func (ec *executionContext) field_Query_userByTier_argsTier( - ctx context.Context, - rawArgs map[string]interface{}, -) (model.Tier, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["tier"] - if !ok { - var zeroVal model.Tier - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("tier")) - if tmp, ok := rawArgs["tier"]; ok { - return ec.unmarshalNTier2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋmodelᚐTier(ctx, tmp) - } - - var zeroVal model.Tier - return zeroVal, nil -} - -func (ec *executionContext) field_Query_userByTier_argsDarkMode( - ctx context.Context, - rawArgs map[string]interface{}, -) (*model.Prefs, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["darkMode"] - if !ok { - var zeroVal *model.Prefs - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("darkMode")) - if tmp, ok := rawArgs["darkMode"]; ok { - return ec.unmarshalNDarkMode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋmodelᚐPrefs(ctx, tmp) - } - - var zeroVal *model.Prefs - return zeroVal, nil -} func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_user_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 external.ObjectID + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋexternalᚐObjectID(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_user_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (external.ObjectID, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal external.ObjectID - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋscalarsᚋexternalᚐObjectID(ctx, tmp) - } - - var zeroVal external.ObjectID - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/selection/generated.go b/_examples/selection/generated.go index 7eb8599d721..79f349b9973 100644 --- a/_examples/selection/generated.go +++ b/_examples/selection/generated.go @@ -262,98 +262,47 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/starwars/generated/exec.go b/_examples/starwars/generated/exec.go index f2528a9c312..c6f909fd0a8 100644 --- a/_examples/starwars/generated/exec.go +++ b/_examples/starwars/generated/exec.go @@ -760,590 +760,263 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_Droid_friendsConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Droid_friendsConnection_argsFirst(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["first"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["first"] = arg0 - arg1, err := ec.field_Droid_friendsConnection_argsAfter(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *string + if tmp, ok := rawArgs["after"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["after"] = arg1 return args, nil } -func (ec *executionContext) field_Droid_friendsConnection_argsFirst( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["first"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) - if tmp, ok := rawArgs["first"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} - -func (ec *executionContext) field_Droid_friendsConnection_argsAfter( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["after"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) - if tmp, ok := rawArgs["after"]; ok { - return ec.unmarshalOID2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) field_Human_friendsConnection_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Human_friendsConnection_argsFirst(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["first"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["first"] = arg0 - arg1, err := ec.field_Human_friendsConnection_argsAfter(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *string + if tmp, ok := rawArgs["after"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + arg1, err = ec.unmarshalOID2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["after"] = arg1 return args, nil } -func (ec *executionContext) field_Human_friendsConnection_argsFirst( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["first"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) - if tmp, ok := rawArgs["first"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} - -func (ec *executionContext) field_Human_friendsConnection_argsAfter( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["after"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) - if tmp, ok := rawArgs["after"]; ok { - return ec.unmarshalOID2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) field_Human_height_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Human_height_argsUnit(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 models.LengthUnit + if tmp, ok := rawArgs["unit"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("unit")) + arg0, err = ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) + if err != nil { + return nil, err + } } args["unit"] = arg0 return args, nil } -func (ec *executionContext) field_Human_height_argsUnit( - ctx context.Context, - rawArgs map[string]interface{}, -) (models.LengthUnit, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["unit"] - if !ok { - var zeroVal models.LengthUnit - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("unit")) - if tmp, ok := rawArgs["unit"]; ok { - return ec.unmarshalOLengthUnit2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) - } - - var zeroVal models.LengthUnit - return zeroVal, nil -} func (ec *executionContext) field_Mutation_createReview_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_createReview_argsEpisode(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 models.Episode + if tmp, ok := rawArgs["episode"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("episode")) + arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) + if err != nil { + return nil, err + } } args["episode"] = arg0 - arg1, err := ec.field_Mutation_createReview_argsReview(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 models.Review + if tmp, ok := rawArgs["review"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("review")) + arg1, err = ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐReview(ctx, tmp) + if err != nil { + return nil, err + } } args["review"] = arg1 return args, nil } -func (ec *executionContext) field_Mutation_createReview_argsEpisode( - ctx context.Context, - rawArgs map[string]interface{}, -) (models.Episode, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["episode"] - if !ok { - var zeroVal models.Episode - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("episode")) - if tmp, ok := rawArgs["episode"]; ok { - return ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) - } - - var zeroVal models.Episode - return zeroVal, nil -} - -func (ec *executionContext) field_Mutation_createReview_argsReview( - ctx context.Context, - rawArgs map[string]interface{}, -) (models.Review, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["review"] - if !ok { - var zeroVal models.Review - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("review")) - if tmp, ok := rawArgs["review"]; ok { - return ec.unmarshalNReviewInput2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐReview(ctx, tmp) - } - - var zeroVal models.Review - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_character_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_character_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_character_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_droid_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_droid_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_droid_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_hero_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_hero_argsEpisode(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *models.Episode + if tmp, ok := rawArgs["episode"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("episode")) + arg0, err = ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) + if err != nil { + return nil, err + } } args["episode"] = arg0 return args, nil } -func (ec *executionContext) field_Query_hero_argsEpisode( - ctx context.Context, - rawArgs map[string]interface{}, -) (*models.Episode, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["episode"] - if !ok { - var zeroVal *models.Episode - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("episode")) - if tmp, ok := rawArgs["episode"]; ok { - return ec.unmarshalOEpisode2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) - } - - var zeroVal *models.Episode - return zeroVal, nil -} func (ec *executionContext) field_Query_human_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_human_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_human_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_reviews_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_reviews_argsEpisode(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 models.Episode + if tmp, ok := rawArgs["episode"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("episode")) + arg0, err = ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) + if err != nil { + return nil, err + } } args["episode"] = arg0 - arg1, err := ec.field_Query_reviews_argsSince(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *time.Time + if tmp, ok := rawArgs["since"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("since")) + arg1, err = ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) + if err != nil { + return nil, err + } } args["since"] = arg1 return args, nil } -func (ec *executionContext) field_Query_reviews_argsEpisode( - ctx context.Context, - rawArgs map[string]interface{}, -) (models.Episode, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["episode"] - if !ok { - var zeroVal models.Episode - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("episode")) - if tmp, ok := rawArgs["episode"]; ok { - return ec.unmarshalNEpisode2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐEpisode(ctx, tmp) - } - - var zeroVal models.Episode - return zeroVal, nil -} - -func (ec *executionContext) field_Query_reviews_argsSince( - ctx context.Context, - rawArgs map[string]interface{}, -) (*time.Time, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["since"] - if !ok { - var zeroVal *time.Time - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("since")) - if tmp, ok := rawArgs["since"]; ok { - return ec.unmarshalOTime2ᚖtimeᚐTime(ctx, tmp) - } - - var zeroVal *time.Time - return zeroVal, nil -} func (ec *executionContext) field_Query_search_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_search_argsText(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["text"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["text"] = arg0 return args, nil } -func (ec *executionContext) field_Query_search_argsText( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["text"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) - if tmp, ok := rawArgs["text"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_starship_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_starship_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_starship_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Starship_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Starship_length_argsUnit(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *models.LengthUnit + if tmp, ok := rawArgs["unit"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("unit")) + arg0, err = ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) + if err != nil { + return nil, err + } } args["unit"] = arg0 return args, nil } -func (ec *executionContext) field_Starship_length_argsUnit( - ctx context.Context, - rawArgs map[string]interface{}, -) (*models.LengthUnit, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["unit"] - if !ok { - var zeroVal *models.LengthUnit - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("unit")) - if tmp, ok := rawArgs["unit"]; ok { - return ec.unmarshalOLengthUnit2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋstarwarsᚋmodelsᚐLengthUnit(ctx, tmp) - } - - var zeroVal *models.LengthUnit - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/_examples/todo/generated.go b/_examples/todo/generated.go index 755dfbd6249..55dcbd021bd 100644 --- a/_examples/todo/generated.go +++ b/_examples/todo/generated.go @@ -298,285 +298,131 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) dir_hasRole_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_hasRole_argsRole(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 Role + if tmp, ok := rawArgs["role"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("role")) + arg0, err = ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtodoᚐRole(ctx, tmp) + if err != nil { + return nil, err + } } args["role"] = arg0 return args, nil } -func (ec *executionContext) dir_hasRole_argsRole( - ctx context.Context, - rawArgs map[string]interface{}, -) (Role, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["role"] - if !ok { - var zeroVal Role - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("role")) - if tmp, ok := rawArgs["role"]; ok { - return ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtodoᚐRole(ctx, tmp) - } - - var zeroVal Role - return zeroVal, nil -} func (ec *executionContext) dir_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_user_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) dir_user_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyMutation_createTodo_argsTodo(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 TodoInput + if tmp, ok := rawArgs["todo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("todo")) + arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtodoᚐTodoInput(ctx, tmp) + if err != nil { + return nil, err + } } args["todo"] = arg0 return args, nil } -func (ec *executionContext) field_MyMutation_createTodo_argsTodo( - ctx context.Context, - rawArgs map[string]interface{}, -) (TodoInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["todo"] - if !ok { - var zeroVal TodoInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("todo")) - if tmp, ok := rawArgs["todo"]; ok { - return ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtodoᚐTodoInput(ctx, tmp) - } - - var zeroVal TodoInput - return zeroVal, nil -} func (ec *executionContext) field_MyMutation_updateTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyMutation_updateTodo_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 - arg1, err := ec.field_MyMutation_updateTodo_argsChanges(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 map[string]interface{} + if tmp, ok := rawArgs["changes"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("changes")) + arg1, err = ec.unmarshalNMap2map(ctx, tmp) + if err != nil { + return nil, err + } } args["changes"] = arg1 return args, nil } -func (ec *executionContext) field_MyMutation_updateTodo_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} - -func (ec *executionContext) field_MyMutation_updateTodo_argsChanges( - ctx context.Context, - rawArgs map[string]interface{}, -) (map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["changes"] - if !ok { - var zeroVal map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("changes")) - if tmp, ok := rawArgs["changes"]; ok { - return ec.unmarshalNMap2map(ctx, tmp) - } - - var zeroVal map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyQuery___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_MyQuery___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyQuery_todo_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2int(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_MyQuery_todo_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -1171,16 +1017,13 @@ func (ec *executionContext) _Todo_done(ctx context.Context, field graphql.Collec ctx = rctx // use context from middleware stack in children return obj.Done, nil } - directive1 := func(ctx context.Context) (interface{}, error) { role, err := ec.unmarshalNRole2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtodoᚐRole(ctx, "OWNER") if err != nil { - var zeroVal bool - return zeroVal, err + return nil, err } if ec.directives.HasRole == nil { - var zeroVal bool - return zeroVal, errors.New("directive hasRole is not implemented") + return nil, errors.New("directive hasRole is not implemented") } return ec.directives.HasRole(ctx, obj, directive0, role) } diff --git a/_examples/type-system-extension/generated.go b/_examples/type-system-extension/generated.go index f919ba26a5c..f484dfd1e83 100644 --- a/_examples/type-system-extension/generated.go +++ b/_examples/type-system-extension/generated.go @@ -292,162 +292,77 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) field_MyMutation_createTodo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyMutation_createTodo_argsTodo(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 TodoInput + if tmp, ok := rawArgs["todo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("todo")) + arg0, err = ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx, tmp) + if err != nil { + return nil, err + } } args["todo"] = arg0 return args, nil } -func (ec *executionContext) field_MyMutation_createTodo_argsTodo( - ctx context.Context, - rawArgs map[string]interface{}, -) (TodoInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["todo"] - if !ok { - var zeroVal TodoInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("todo")) - if tmp, ok := rawArgs["todo"]; ok { - return ec.unmarshalNTodoInput2githubᚗcomᚋ99designsᚋgqlgenᚋ_examplesᚋtypeᚑsystemᚑextensionᚐTodoInput(ctx, tmp) - } - - var zeroVal TodoInput - return zeroVal, nil -} func (ec *executionContext) field_MyQuery___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyQuery___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_MyQuery___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_MyQuery_todo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_MyQuery_todo_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_MyQuery_todo_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -474,11 +389,9 @@ func (ec *executionContext) _MyMutation_createTodo(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.MyMutation().CreateTodo(rctx, fc.Args["todo"].(TodoInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ObjectLogging == nil { - var zeroVal *Todo - return zeroVal, errors.New("directive objectLogging is not implemented") + return nil, errors.New("directive objectLogging is not implemented") } return ec.directives.ObjectLogging(ctx, nil, directive0) } @@ -561,11 +474,9 @@ func (ec *executionContext) _MyQuery_todos(ctx context.Context, field graphql.Co ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todos(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ObjectLogging == nil { - var zeroVal []*Todo - return zeroVal, errors.New("directive objectLogging is not implemented") + return nil, errors.New("directive objectLogging is not implemented") } return ec.directives.ObjectLogging(ctx, nil, directive0) } @@ -637,11 +548,9 @@ func (ec *executionContext) _MyQuery_todo(ctx context.Context, field graphql.Col ctx = rctx // use context from middleware stack in children return ec.resolvers.MyQuery().Todo(rctx, fc.Args["id"].(string)) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ObjectLogging == nil { - var zeroVal *Todo - return zeroVal, errors.New("directive objectLogging is not implemented") + return nil, errors.New("directive objectLogging is not implemented") } return ec.directives.ObjectLogging(ctx, nil, directive0) } @@ -982,11 +891,9 @@ func (ec *executionContext) _Todo_verified(ctx context.Context, field graphql.Co ctx = rctx // use context from middleware stack in children return obj.Verified, nil } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.FieldLogging == nil { - var zeroVal bool - return zeroVal, errors.New("directive fieldLogging is not implemented") + return nil, errors.New("directive fieldLogging is not implemented") } return ec.directives.FieldLogging(ctx, obj, directive0) } @@ -2821,11 +2728,9 @@ func (ec *executionContext) unmarshalInputTodoInput(ctx context.Context, obj int case "text": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.InputLogging == nil { - var zeroVal string - return zeroVal, errors.New("directive inputLogging is not implemented") + return nil, errors.New("directive inputLogging is not implemented") } return ec.directives.InputLogging(ctx, obj, directive0) } diff --git a/codegen/args.go b/codegen/args.go index e8c1bfeeb9c..983a3a02a71 100644 --- a/codegen/args.go +++ b/codegen/args.go @@ -18,13 +18,12 @@ type ArgSet struct { type FieldArgument struct { *ast.ArgumentDefinition - TypeReference *config.TypeReference - VarName string // The name of the var in go - Object *Object // A link back to the parent object - Default any // The default value - Directives []*Directive - Value any // value set in Data - CallArgumentDirectivesWithNull bool + TypeReference *config.TypeReference + VarName string // The name of the var in go + Object *Object // A link back to the parent object + Default any // The default value + Directives []*Directive + Value any // value set in Data } // ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive @@ -58,12 +57,11 @@ func (b *builder) buildArg(obj *Object, arg *ast.ArgumentDefinition) (*FieldArgu return nil, err } newArg := FieldArgument{ - ArgumentDefinition: arg, - TypeReference: tr, - Object: obj, - VarName: templates.ToGoPrivate(arg.Name), - Directives: argDirs, - CallArgumentDirectivesWithNull: b.Config.CallArgumentDirectivesWithNull, + ArgumentDefinition: arg, + TypeReference: tr, + Object: obj, + VarName: templates.ToGoPrivate(arg.Name), + Directives: argDirs, } if arg.DefaultValue != nil { diff --git a/codegen/args.gotpl b/codegen/args.gotpl index 2f3afdf077f..7b541ae1f2e 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -2,67 +2,35 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - {{- range $i, $arg := . }} - arg{{$i}}, err := ec.{{ $name }}{{$arg.Name | go}}(ctx, rawArgs) - if err != nil { - return nil, err - } - args[{{$arg.Name|quote}}] = arg{{$i}} - {{- end }} - return args, nil -} - - {{- range $i, $arg := . }} - func (ec *executionContext) {{ $name }}{{$arg.Name | go}}( - ctx context.Context, - rawArgs map[string]interface{}, - ) ({{ $arg.TypeReference.GO | ref}}, error) { - {{- if not .CallArgumentDirectivesWithNull}} - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs[{{$arg.Name|quote}}] - if !ok { - var zeroVal {{ $arg.TypeReference.GO | ref}} - return zeroVal, nil - } - {{end}} - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField({{$arg.Name|quote}})) + var arg{{$i}} {{ $arg.TypeReference.GO | ref}} + if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$arg.Name|quote}})) {{- if $arg.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs[{{$arg.Name|quote}}] - if !ok { - var zeroVal {{ $arg.TypeReference.GO | ref}} - return zeroVal, nil - } - return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) - } + directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } {{ template "implDirectives" $arg }} - tmp, err := directive{{$arg.ImplDirectives|len}}(ctx) + tmp, err = directive{{$arg.ImplDirectives|len}}(ctx) if err != nil { - var zeroVal {{ $arg.TypeReference.GO | ref}} - return zeroVal, graphql.ErrorOnPath(ctx, err) + return nil, graphql.ErrorOnPath(ctx, err) } if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok { - return data, nil + arg{{$i}} = data {{- if $arg.TypeReference.IsNilable }} } else if tmp == nil { - var zeroVal {{ $arg.TypeReference.GO | ref}} - return zeroVal, nil + arg{{$i}} = nil {{- end }} } else { - var zeroVal {{ $arg.TypeReference.GO | ref}} - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)) + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)) } {{- else }} - if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { - return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) + arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) + if err != nil { + return nil, err } - - var zeroVal {{ $arg.TypeReference.GO | ref}} - return zeroVal, nil {{- end }} } - {{end}} + args[{{$arg.Name|quote}}] = arg{{$i}} + {{- end }} + return args, nil +} {{ end }} diff --git a/codegen/config/config.go b/codegen/config/config.go index 3e41695bc86..54776083d6d 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -22,42 +22,36 @@ import ( ) type Config struct { - SchemaFilename StringList `yaml:"schema,omitempty"` - Exec ExecConfig `yaml:"exec"` - Model PackageConfig `yaml:"model,omitempty"` - Federation PackageConfig `yaml:"federation,omitempty"` - Resolver ResolverConfig `yaml:"resolver,omitempty"` - AutoBind []string `yaml:"autobind"` - Models TypeMap `yaml:"models,omitempty"` - StructTag string `yaml:"struct_tag,omitempty"` - Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` - GoBuildTags StringList `yaml:"go_build_tags,omitempty"` - GoInitialisms GoInitialismsConfig `yaml:"go_initialisms,omitempty"` - OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` - OmitGetters bool `yaml:"omit_getters,omitempty"` - OmitInterfaceChecks bool `yaml:"omit_interface_checks,omitempty"` - OmitComplexity bool `yaml:"omit_complexity,omitempty"` - OmitGQLGenFileNotice bool `yaml:"omit_gqlgen_file_notice,omitempty"` - OmitGQLGenVersionInFileNotice bool `yaml:"omit_gqlgen_version_in_file_notice,omitempty"` - OmitRootModels bool `yaml:"omit_root_models,omitempty"` - OmitResolverFields bool `yaml:"omit_resolver_fields,omitempty"` - OmitPanicHandler bool `yaml:"omit_panic_handler,omitempty"` - // If this is set to true, argument directives that - // decorate a field with a null value will still be called. - // - // This enables argumment directives to not just mutate - // argument values but to set them even if they're null. - CallArgumentDirectivesWithNull bool `yaml:"call_argument_directives_with_null,omitempty"` - StructFieldsAlwaysPointers bool `yaml:"struct_fields_always_pointers,omitempty"` - ReturnPointersInUnmarshalInput bool `yaml:"return_pointers_in_unmarshalinput,omitempty"` - ResolversAlwaysReturnPointers bool `yaml:"resolvers_always_return_pointers,omitempty"` - NullableInputOmittable bool `yaml:"nullable_input_omittable,omitempty"` - EnableModelJsonOmitemptyTag *bool `yaml:"enable_model_json_omitempty_tag,omitempty"` - SkipValidation bool `yaml:"skip_validation,omitempty"` - SkipModTidy bool `yaml:"skip_mod_tidy,omitempty"` - Sources []*ast.Source `yaml:"-"` - Packages *code.Packages `yaml:"-"` - Schema *ast.Schema `yaml:"-"` + SchemaFilename StringList `yaml:"schema,omitempty"` + Exec ExecConfig `yaml:"exec"` + Model PackageConfig `yaml:"model,omitempty"` + Federation PackageConfig `yaml:"federation,omitempty"` + Resolver ResolverConfig `yaml:"resolver,omitempty"` + AutoBind []string `yaml:"autobind"` + Models TypeMap `yaml:"models,omitempty"` + StructTag string `yaml:"struct_tag,omitempty"` + Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` + GoBuildTags StringList `yaml:"go_build_tags,omitempty"` + GoInitialisms GoInitialismsConfig `yaml:"go_initialisms,omitempty"` + OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` + OmitGetters bool `yaml:"omit_getters,omitempty"` + OmitInterfaceChecks bool `yaml:"omit_interface_checks,omitempty"` + OmitComplexity bool `yaml:"omit_complexity,omitempty"` + OmitGQLGenFileNotice bool `yaml:"omit_gqlgen_file_notice,omitempty"` + OmitGQLGenVersionInFileNotice bool `yaml:"omit_gqlgen_version_in_file_notice,omitempty"` + OmitRootModels bool `yaml:"omit_root_models,omitempty"` + OmitResolverFields bool `yaml:"omit_resolver_fields,omitempty"` + OmitPanicHandler bool `yaml:"omit_panic_handler,omitempty"` + StructFieldsAlwaysPointers bool `yaml:"struct_fields_always_pointers,omitempty"` + ReturnPointersInUnmarshalInput bool `yaml:"return_pointers_in_unmarshalinput,omitempty"` + ResolversAlwaysReturnPointers bool `yaml:"resolvers_always_return_pointers,omitempty"` + NullableInputOmittable bool `yaml:"nullable_input_omittable,omitempty"` + EnableModelJsonOmitemptyTag *bool `yaml:"enable_model_json_omitempty_tag,omitempty"` + SkipValidation bool `yaml:"skip_validation,omitempty"` + SkipModTidy bool `yaml:"skip_mod_tidy,omitempty"` + Sources []*ast.Source `yaml:"-"` + Packages *code.Packages `yaml:"-"` + Schema *ast.Schema `yaml:"-"` // Deprecated: use Federation instead. Will be removed next release Federated bool `yaml:"federated,omitempty"` diff --git a/codegen/directives.gotpl b/codegen/directives.gotpl index 18ad0237111..23bcf0f879b 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -1,25 +1,21 @@ {{ define "implDirectives" }}{{ $in := .DirectiveObjName }} - {{ $zeroVal := .TypeReference.GO | ref}} {{- range $i, $directive := .ImplDirectives -}} directive{{add $i 1}} := func(ctx context.Context) (interface{}, error) { {{- range $arg := $directive.Args }} {{- if notNil "Value" $arg }} {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Value | dump }}) if err != nil{ - var zeroVal {{$zeroVal}} - return zeroVal, err + return nil, err } {{- else if notNil "Default" $arg }} {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }}) if err != nil{ - var zeroVal {{$zeroVal}} - return zeroVal, err + return nil, err } {{- end }} {{- end }} if ec.directives.{{$directive.Name|ucFirst}} == nil { - var zeroVal {{$zeroVal}} - return zeroVal, errors.New("directive {{$directive.Name}} is not implemented") + return nil, errors.New("directive {{$directive.Name}} is not implemented") } return ec.directives.{{$directive.Name|ucFirst}}({{$directive.ResolveArgs $in $i }}) } diff --git a/codegen/testserver/followschema/defaults.generated.go b/codegen/testserver/followschema/defaults.generated.go index 19f8cee1c8b..fd86e3a70ee 100644 --- a/codegen/testserver/followschema/defaults.generated.go +++ b/codegen/testserver/followschema/defaults.generated.go @@ -29,130 +29,62 @@ type MutationResolver interface { func (ec *executionContext) field_Mutation_defaultInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_defaultInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 DefaultInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNDefaultInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐDefaultInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_defaultInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (DefaultInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal DefaultInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNDefaultInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐDefaultInput(ctx, tmp) - } - - var zeroVal DefaultInput - return zeroVal, nil -} func (ec *executionContext) field_Mutation_overrideValueViaInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_overrideValueViaInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 FieldsOrderInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNFieldsOrderInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐFieldsOrderInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_overrideValueViaInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (FieldsOrderInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal FieldsOrderInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNFieldsOrderInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐFieldsOrderInput(ctx, tmp) - } - - var zeroVal FieldsOrderInput - return zeroVal, nil -} func (ec *executionContext) field_Mutation_updatePtrToPtr_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_updatePtrToPtr_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 UpdatePtrToPtrOuter + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNUpdatePtrToPtrOuter2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐUpdatePtrToPtrOuter(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_updatePtrToPtr_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (UpdatePtrToPtrOuter, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal UpdatePtrToPtrOuter - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNUpdatePtrToPtrOuter2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐUpdatePtrToPtrOuter(ctx, tmp) - } - - var zeroVal UpdatePtrToPtrOuter - return zeroVal, 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{}{} - arg0, err := ec.field_Mutation_updateSomething_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 SpecialInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSpecialInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_updateSomething_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (SpecialInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal SpecialInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐSpecialInput(ctx, tmp) - } - - var zeroVal SpecialInput - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/codegen/testserver/followschema/directive.generated.go b/codegen/testserver/followschema/directive.generated.go index b694064fad1..05d52fee069 100644 --- a/codegen/testserver/followschema/directive.generated.go +++ b/codegen/testserver/followschema/directive.generated.go @@ -22,275 +22,104 @@ import ( func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_length_argsMin(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["min"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["min"] = arg0 - arg1, err := ec.dir_length_argsMax(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *int + if tmp, ok := rawArgs["max"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["max"] = arg1 - arg2, err := ec.dir_length_argsMessage(ctx, rawArgs) - if err != nil { - return nil, err + var arg2 *string + if tmp, ok := rawArgs["message"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("message")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["message"] = arg2 return args, nil } -func (ec *executionContext) dir_length_argsMin( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["min"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - if tmp, ok := rawArgs["min"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} - -func (ec *executionContext) dir_length_argsMax( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["max"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) - if tmp, ok := rawArgs["max"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} - -func (ec *executionContext) dir_length_argsMessage( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["message"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("message")) - if tmp, ok := rawArgs["message"]; ok { - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) dir_logged_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_logged_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNUUID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) dir_logged_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNUUID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) dir_order1_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_order1_argsLocation(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["location"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["location"] = arg0 return args, nil } -func (ec *executionContext) dir_order1_argsLocation( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["location"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) - if tmp, ok := rawArgs["location"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) dir_order2_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_order2_argsLocation(ctx, rawArgs) - if err != nil { - return nil, err - } - args["location"] = arg0 - return args, nil -} -func (ec *executionContext) dir_order2_argsLocation( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["location"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) + var arg0 string if tmp, ok := rawArgs["location"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) dir_populate_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.dir_populate_argsValue(ctx, rawArgs) - if err != nil { - return nil, err + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - args["value"] = arg0 + args["location"] = arg0 return args, nil } -func (ec *executionContext) dir_populate_argsValue( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["value"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) - if tmp, ok := rawArgs["value"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_range_argsMin(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["min"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["min"] = arg0 - arg1, err := ec.dir_range_argsMax(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *int + if tmp, ok := rawArgs["max"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["max"] = arg1 return args, nil } -func (ec *executionContext) dir_range_argsMin( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["min"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - if tmp, ok := rawArgs["min"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} - -func (ec *executionContext) dir_range_argsMax( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["max"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) - if tmp, ok := rawArgs["max"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -345,26 +174,21 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return obj.Text, nil } - directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, max, message) } @@ -423,11 +247,9 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, ctx = rctx // use context from middleware stack in children return obj.NullableText, nil } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + return nil, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -524,11 +346,9 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx ctx = rctx // use context from middleware stack in children return obj.NullableText, nil } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { - var zeroVal string - return zeroVal, errors.New("directive toNull is not implemented") + return nil, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -588,21 +408,17 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o case "message": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, nil, message) } @@ -640,33 +456,27 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "text": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal string - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, message) } @@ -684,18 +494,15 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "nullableText": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nullableText")) directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + return nil, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive1) } @@ -717,11 +524,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerDirectives(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *InnerDirectives - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -743,11 +548,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerDirectives(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *InnerDirectives - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -769,28 +572,23 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐThirdParty(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *ThirdParty - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { - var zeroVal *ThirdParty - return zeroVal, err + return nil, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - var zeroVal *ThirdParty - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal *ThirdParty - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, nil) } diff --git a/codegen/testserver/followschema/directive.graphql b/codegen/testserver/followschema/directive.graphql index 5f30693755e..8cf2470986e 100644 --- a/codegen/testserver/followschema/directive.graphql +++ b/codegen/testserver/followschema/directive.graphql @@ -3,21 +3,16 @@ directive @range(min: Int = 0, max: Int) on ARGUMENT_DEFINITION directive @custom on ARGUMENT_DEFINITION directive @logged(id: UUID!) on FIELD directive @toNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINITION -directive @populate(value: String!) on ARGUMENT_DEFINITION directive @directive1 on FIELD_DEFINITION directive @directive2 on FIELD_DEFINITION directive @directive3 on INPUT_OBJECT directive @unimplemented on FIELD_DEFINITION directive @order1(location: String!) repeatable on FIELD_DEFINITION | OBJECT directive @order2(location: String!) on OBJECT -directive @noop on ARGUMENT_DEFINITION extend type Query { directiveArg(arg: String! @length(min:1, max: 255, message: "invalid length")): String directiveNullableArg(arg: Int @range(min:0), arg2: Int @range, arg3: String @toNull): String - directiveSingleNullableArg( - arg1: String @populate(value: "test") @noop, - ): String directiveInputNullable(arg: InputDirectives): String directiveInput(arg: InputDirectives!): String directiveInputType(arg: InnerInput! @custom): String diff --git a/codegen/testserver/followschema/directive_test.go b/codegen/testserver/followschema/directive_test.go index f5b8af5f50d..92f13c4afcc 100644 --- a/codegen/testserver/followschema/directive_test.go +++ b/codegen/testserver/followschema/directive_test.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "reflect" "testing" "github.com/stretchr/testify/require" @@ -14,17 +13,6 @@ import ( "github.com/99designs/gqlgen/graphql/handler" ) -// isNil checks if the given value is nil -func isNil(input any) bool { - if input == nil { - return true - } - // Using reflect to check if the value is nil. This is necessary for - // for any types that are not nil types but have a nil value (e.g. *string). - value := reflect.ValueOf(input) - return value.IsNil() -} - type ckey string func TestDirectives(t *testing.T) { @@ -46,14 +34,6 @@ func TestDirectives(t *testing.T) { return &ok, nil } - resolvers.QueryResolver.DirectiveSingleNullableArg = func(ctx context.Context, arg1 *string) (*string, error) { - if arg1 != nil { - return arg1, nil - } - - return &ok, nil - } - resolvers.QueryResolver.DirectiveInputType = func(ctx context.Context, arg InnerInput) (i *string, e error) { return &ok, nil } @@ -139,10 +119,6 @@ func TestDirectives(t *testing.T) { return nil, err } - if isNil(res) { - return res, err - } - switch res := res.(type) { case int: if min != nil && res < *min { @@ -182,21 +158,6 @@ func TestDirectives(t *testing.T) { ToNull: func(ctx context.Context, obj any, next graphql.Resolver) (any, error) { return nil, nil }, - Populate: func(ctx context.Context, obj any, next graphql.Resolver, value string) (any, error) { - res, err := next(ctx) - if err != nil { - return nil, err - } - - if !isNil(res) { - return res, err - } - - return &value, nil - }, - Noop: func(ctx context.Context, obj any, next graphql.Resolver) (any, error) { - return next(ctx) - }, Directive1: func(ctx context.Context, obj any, next graphql.Resolver) (res any, err error) { return next(ctx) }, @@ -287,17 +248,6 @@ func TestDirectives(t *testing.T) { require.NoError(t, err) require.Equal(t, "Ok", *resp.DirectiveArg) }) - - t.Run("directive is not called with null arguments", func(t *testing.T) { - var resp struct { - DirectiveSingleNullableArg *string - } - - err := c.Post(`query { directiveSingleNullableArg }`, &resp) - - require.NoError(t, err) - require.Equal(t, "Ok", *resp.DirectiveSingleNullableArg) - }) }) t.Run("field definition directives", func(t *testing.T) { resolvers.QueryResolver.DirectiveFieldDef = func(ctx context.Context, ret string) (i string, e error) { diff --git a/codegen/testserver/followschema/panics.generated.go b/codegen/testserver/followschema/panics.generated.go index edaf7071f08..dbd455a8ba8 100644 --- a/codegen/testserver/followschema/panics.generated.go +++ b/codegen/testserver/followschema/panics.generated.go @@ -27,66 +27,32 @@ type PanicsResolver interface { 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{}{} - arg0, err := ec.field_Panics_argUnmarshal_argsU(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []MarshalPanic + if tmp, ok := rawArgs["u"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["u"] = arg0 return args, nil } -func (ec *executionContext) field_Panics_argUnmarshal_argsU( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]MarshalPanic, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["u"] - if !ok { - var zeroVal []MarshalPanic - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) - if tmp, ok := rawArgs["u"]; ok { - return ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp) - } - - var zeroVal []MarshalPanic - return zeroVal, nil -} func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Panics_fieldFuncMarshal_argsU(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []MarshalPanic + if tmp, ok := rawArgs["u"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["u"] = arg0 return args, nil } -func (ec *executionContext) field_Panics_fieldFuncMarshal_argsU( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]MarshalPanic, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["u"] - if !ok { - var zeroVal []MarshalPanic - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) - if tmp, ok := rawArgs["u"]; ok { - return ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐMarshalPanicᚄ(ctx, tmp) - } - - var zeroVal []MarshalPanic - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/codegen/testserver/followschema/prelude.generated.go b/codegen/testserver/followschema/prelude.generated.go index 36cf9b2bbc3..48258897fd1 100644 --- a/codegen/testserver/followschema/prelude.generated.go +++ b/codegen/testserver/followschema/prelude.generated.go @@ -24,66 +24,32 @@ import ( func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/codegen/testserver/followschema/resolver.go b/codegen/testserver/followschema/resolver.go index 81a21cb9df7..4f34d896136 100644 --- a/codegen/testserver/followschema/resolver.go +++ b/codegen/testserver/followschema/resolver.go @@ -217,11 +217,6 @@ func (r *queryResolver) DirectiveNullableArg(ctx context.Context, arg *int, arg2 panic("not implemented") } -// DirectiveSingleNullableArg is the resolver for the directiveSingleNullableArg field. -func (r *queryResolver) DirectiveSingleNullableArg(ctx context.Context, arg1 *string) (*string, error) { - panic("not implemented") -} - // DirectiveInputNullable is the resolver for the directiveInputNullable field. func (r *queryResolver) DirectiveInputNullable(ctx context.Context, arg *InputDirectives) (*string, error) { panic("not implemented") diff --git a/codegen/testserver/followschema/root_.generated.go b/codegen/testserver/followschema/root_.generated.go index b4fafbc1d57..230af5e94a9 100644 --- a/codegen/testserver/followschema/root_.generated.go +++ b/codegen/testserver/followschema/root_.generated.go @@ -63,10 +63,8 @@ type DirectiveRoot struct { Logged func(ctx context.Context, obj interface{}, next graphql.Resolver, id string) (res interface{}, err error) MakeNil func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) MakeTypedNil func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) - Noop func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) Order1 func(ctx context.Context, obj interface{}, next graphql.Resolver, location string) (res interface{}, err error) Order2 func(ctx context.Context, obj interface{}, next graphql.Resolver, location string) (res interface{}, err error) - Populate func(ctx context.Context, obj interface{}, next graphql.Resolver, value string) (res interface{}, err error) Range func(ctx context.Context, obj interface{}, next graphql.Resolver, min *int, max *int) (res interface{}, err error) ToNull func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) Unimplemented func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) @@ -339,7 +337,6 @@ type ComplexityRoot struct { DirectiveNullableArg func(childComplexity int, arg *int, arg2 *int, arg3 *string) int DirectiveObject func(childComplexity int) int DirectiveObjectWithCustomGoModel func(childComplexity int) int - DirectiveSingleNullableArg func(childComplexity int, arg1 *string) int DirectiveUnimplemented func(childComplexity int) int Dog func(childComplexity int) int EmbeddedCase1 func(childComplexity int) int @@ -1402,18 +1399,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.DirectiveObjectWithCustomGoModel(childComplexity), true - case "Query.directiveSingleNullableArg": - if e.complexity.Query.DirectiveSingleNullableArg == nil { - break - } - - args, err := ec.field_Query_directiveSingleNullableArg_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.DirectiveSingleNullableArg(childComplexity, args["arg1"].(*string)), true - case "Query.directiveUnimplemented": if e.complexity.Query.DirectiveUnimplemented == nil { break diff --git a/codegen/testserver/followschema/schema.generated.go b/codegen/testserver/followschema/schema.generated.go index e98ff8cdcd9..dc2f12528e1 100644 --- a/codegen/testserver/followschema/schema.generated.go +++ b/codegen/testserver/followschema/schema.generated.go @@ -53,7 +53,6 @@ type QueryResolver interface { DeferCase2(ctx context.Context) ([]*DeferModel, error) DirectiveArg(ctx context.Context, arg string) (*string, error) DirectiveNullableArg(ctx context.Context, arg *int, arg2 *int, arg3 *string) (*string, error) - DirectiveSingleNullableArg(ctx context.Context, arg1 *string) (*string, error) DirectiveInputNullable(ctx context.Context, arg *InputDirectives) (*string, error) DirectiveInput(ctx context.Context, arg InputDirectives) (*string, error) DirectiveInputType(ctx context.Context, arg InnerInput) (*string, error) @@ -128,1331 +127,617 @@ type UserResolver interface { func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["if"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["if"] = arg0 - arg1, err := ec.dir_defer_argsLabel(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *string + if tmp, ok := rawArgs["label"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["label"] = arg1 return args, nil } -func (ec *executionContext) dir_defer_argsIf( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["if"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - if tmp, ok := rawArgs["if"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} - -func (ec *executionContext) dir_defer_argsLabel( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["label"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) - if tmp, ok := rawArgs["label"]; ok { - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) field_Pet_friends_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Pet_friends_argsLimit(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["limit"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["limit"] = arg0 return args, nil } -func (ec *executionContext) field_Pet_friends_argsLimit( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["limit"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) - if tmp, ok := rawArgs["limit"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_defaultParameters_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_defaultParameters_argsFalsyBoolean(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["falsyBoolean"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("falsyBoolean")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["falsyBoolean"] = arg0 - arg1, err := ec.field_Query_defaultParameters_argsTruthyBoolean(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *bool + if tmp, ok := rawArgs["truthyBoolean"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("truthyBoolean")) + arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["truthyBoolean"] = arg1 return args, nil } -func (ec *executionContext) field_Query_defaultParameters_argsFalsyBoolean( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["falsyBoolean"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("falsyBoolean")) - if tmp, ok := rawArgs["falsyBoolean"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} - -func (ec *executionContext) field_Query_defaultParameters_argsTruthyBoolean( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["truthyBoolean"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("truthyBoolean")) - if tmp, ok := rawArgs["truthyBoolean"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_defaultScalar_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_defaultScalar_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_directiveArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 255) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") + if err != nil { + return nil, err + } + if ec.directives.Length == nil { + return nil, errors.New("directive length is not implemented") + } + return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - return ec.unmarshalNString2string(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalNInt2int(ctx, 1) + tmp, err = directive1(ctx) if err != nil { - var zeroVal string - return zeroVal, err - } - max, err := ec.unmarshalOInt2ᚖint(ctx, 255) - if err != nil { - var zeroVal string - return zeroVal, err - } - message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") - if err != nil { - var zeroVal string - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + if data, ok := tmp.(string); ok { + arg0 = data + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } - return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(string); ok { - return data, nil - } else { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Query_directiveFieldDef_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveFieldDef_argsRet(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["ret"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ret")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["ret"] = arg0 return args, nil } -func (ec *executionContext) field_Query_directiveFieldDef_argsRet( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["ret"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("ret")) - if tmp, ok := rawArgs["ret"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveInputNullable_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *InputDirectives + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputDirectives(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_directiveInputNullable_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*InputDirectives, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *InputDirectives - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputDirectives(ctx, tmp) - } - - var zeroVal *InputDirectives - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveInputType_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_directiveInputType_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (InnerInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal InnerInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal InnerInput - return zeroVal, nil + var arg0 InnerInput + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + directive0 := func(ctx context.Context) (interface{}, error) { + return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerInput(ctx, tmp) } - return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerInput(ctx, tmp) - } - - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Custom == nil { - var zeroVal InnerInput - return zeroVal, errors.New("directive custom is not implemented") + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.Custom == nil { + return nil, errors.New("directive custom is not implemented") + } + return ec.directives.Custom(ctx, rawArgs, directive0) } - return ec.directives.Custom(ctx, rawArgs, directive0) - } - tmp, err := directive1(ctx) - if err != nil { - var zeroVal InnerInput - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(InnerInput); ok { - return data, nil - } else { - var zeroVal InnerInput - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be github.com/99designs/gqlgen/codegen/testserver/followschema.InnerInput`, tmp)) + tmp, err = directive1(ctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if data, ok := tmp.(InnerInput); ok { + arg0 = data + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be github.com/99designs/gqlgen/codegen/testserver/followschema.InnerInput`, tmp)) + } } + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveInput_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 InputDirectives + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputDirectives(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_directiveInput_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (InputDirectives, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal InputDirectives - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputDirectives(ctx, tmp) - } - - var zeroVal InputDirectives - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveNullableArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - arg1, err := ec.field_Query_directiveNullableArg_argsArg2(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg2"] = arg1 - arg2, err := ec.field_Query_directiveNullableArg_argsArg3(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg3"] = arg2 - return args, nil -} -func (ec *executionContext) field_Query_directiveNullableArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg0 = data + } else if tmp == nil { + arg0 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Query_directiveNullableArg_argsArg2( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg2")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil + args["arg"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["arg2"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err - } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") - } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Query_directiveNullableArg_argsArg3( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg3")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil + return nil, graphql.ErrorOnPath(ctx, err) } - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + if data, ok := tmp.(*int); ok { + arg1 = data + } else if tmp == nil { + arg1 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.ToNull(ctx, rawArgs, directive0) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*string); ok { - return data, nil - } else if tmp == nil { - var zeroVal *string - return zeroVal, nil - } else { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } -} - -func (ec *executionContext) field_Query_directiveSingleNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveSingleNullableArg_argsArg1(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg1"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_directiveSingleNullableArg_argsArg1( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg1"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg1")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg1"] - if !ok { - var zeroVal *string - return zeroVal, nil + args["arg2"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["arg3"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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") + } + return ec.directives.ToNull(ctx, rawArgs, directive0) } - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - value, err := ec.unmarshalNString2string(ctx, "test") + tmp, err = directive1(ctx) if err != nil { - var zeroVal *string - return zeroVal, err - } - if ec.directives.Populate == nil { - var zeroVal *string - return zeroVal, errors.New("directive populate is not implemented") + return nil, graphql.ErrorOnPath(ctx, err) } - return ec.directives.Populate(ctx, rawArgs, directive0, value) - } - directive2 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Noop == nil { - var zeroVal *string - return zeroVal, errors.New("directive noop is not implemented") + if data, ok := tmp.(*string); ok { + arg2 = data + } else if tmp == nil { + arg2 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } - return ec.directives.Noop(ctx, rawArgs, directive1) - } - - tmp, err := directive2(ctx) - if err != nil { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*string); ok { - return data, nil - } else if tmp == nil { - var zeroVal *string - return zeroVal, nil - } else { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } + args["arg3"] = arg2 + return args, nil } func (ec *executionContext) field_Query_enumInInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_enumInInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *InputWithEnumValue + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputWithEnumValue(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_enumInInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*InputWithEnumValue, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *InputWithEnumValue - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInputWithEnumValue(ctx, tmp) - } - - var zeroVal *InputWithEnumValue - return zeroVal, nil -} func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_fallback_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 FallbackToStringEncoding + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐFallbackToStringEncoding(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_fallback_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (FallbackToStringEncoding, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal FallbackToStringEncoding - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐFallbackToStringEncoding(ctx, tmp) - } - - var zeroVal FallbackToStringEncoding - return zeroVal, nil -} func (ec *executionContext) field_Query_inputNullableSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_inputNullableSlice_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_inputNullableSlice_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal []string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + var arg0 []string if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) - } - - var zeroVal []string - return zeroVal, nil -} - -func (ec *executionContext) field_Query_inputOmittable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.field_Query_inputOmittable_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_inputOmittable_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (OmittableInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal OmittableInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNOmittableInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐOmittableInput(ctx, tmp) - } - - var zeroVal OmittableInput - return zeroVal, nil + return args, nil } -func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { +func (ec *executionContext) field_Query_inputOmittable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_inputSlice_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 OmittableInput + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNOmittableInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐOmittableInput(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_inputSlice_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal []string - return zeroVal, nil - } - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) +func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { + var err error + args := map[string]interface{}{} + var arg0 []string if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } } - - var zeroVal []string - return zeroVal, nil + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_mapInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 map[string]interface{} + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOChanges2map(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_mapInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOChanges2map(ctx, tmp) - } - - var zeroVal map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field_Query_mapNestedStringInterface_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_mapNestedStringInterface_argsIn(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *NestedMapInput + if tmp, ok := rawArgs["in"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) + arg0, err = ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNestedMapInput(ctx, tmp) + if err != nil { + return nil, err + } } args["in"] = arg0 return args, nil } -func (ec *executionContext) field_Query_mapNestedStringInterface_argsIn( - ctx context.Context, - rawArgs map[string]interface{}, -) (*NestedMapInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["in"] - if !ok { - var zeroVal *NestedMapInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) - if tmp, ok := rawArgs["in"]; ok { - return ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐNestedMapInput(ctx, tmp) - } - - var zeroVal *NestedMapInput - return zeroVal, nil -} func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_mapStringInterface_argsIn(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 map[string]interface{} + if tmp, ok := rawArgs["in"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) + arg0, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) + if err != nil { + return nil, err + } } args["in"] = arg0 return args, nil } -func (ec *executionContext) field_Query_mapStringInterface_argsIn( - ctx context.Context, - rawArgs map[string]interface{}, -) (map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["in"] - if !ok { - var zeroVal map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) - if tmp, ok := rawArgs["in"]; ok { - return ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) - } - - var zeroVal map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_nestedInputs_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 [][]*OuterInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐOuterInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_nestedInputs_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) ([][]*OuterInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal [][]*OuterInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐOuterInput(ctx, tmp) - } - - var zeroVal [][]*OuterInput - return zeroVal, nil -} func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_nullableArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_nullableArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_recursive_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *RecursiveInputSlice + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐRecursiveInputSlice(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_recursive_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*RecursiveInputSlice, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *RecursiveInputSlice - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐRecursiveInputSlice(ctx, tmp) - } - - var zeroVal *RecursiveInputSlice - return zeroVal, nil -} func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_user_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_user_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_Subscription_directiveArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Subscription_directiveArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Subscription_directiveArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 255) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") + if err != nil { + return nil, err + } + if ec.directives.Length == nil { + return nil, errors.New("directive length is not implemented") + } + return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - return ec.unmarshalNString2string(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalNInt2int(ctx, 1) - if err != nil { - var zeroVal string - return zeroVal, err - } - max, err := ec.unmarshalOInt2ᚖint(ctx, 255) - if err != nil { - var zeroVal string - return zeroVal, err - } - message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") + tmp, err = directive1(ctx) if err != nil { - var zeroVal string - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + if data, ok := tmp.(string); ok { + arg0 = data + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } - return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(string); ok { - return data, nil - } else { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Subscription_directiveNullableArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - arg1, err := ec.field_Subscription_directiveNullableArg_argsArg2(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg2"] = arg1 - arg2, err := ec.field_Subscription_directiveNullableArg_argsArg3(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg3"] = arg2 - return args, nil -} -func (ec *executionContext) field_Subscription_directiveNullableArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg0 = data + } else if tmp == nil { + arg0 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Subscription_directiveNullableArg_argsArg2( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg2")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil + args["arg"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["arg2"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg1 = data + } else if tmp == nil { + arg1 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Subscription_directiveNullableArg_argsArg3( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg3")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil + args["arg2"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["arg3"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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") + } + return ec.directives.ToNull(ctx, rawArgs, directive0) } - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + tmp, err = directive1(ctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if data, ok := tmp.(*string); ok { + arg2 = data + } else if tmp == nil { + arg2 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } - return ec.directives.ToNull(ctx, rawArgs, directive0) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*string); ok { - return data, nil - } else if tmp == nil { - var zeroVal *string - return zeroVal, nil - } else { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } + args["arg3"] = arg2 + return args, nil } func (ec *executionContext) field_User_pets_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_User_pets_argsLimit(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["limit"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["limit"] = arg0 return args, nil } -func (ec *executionContext) field_User_pets_argsLimit( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["limit"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) - if tmp, ok := rawArgs["limit"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -3194,55 +2479,6 @@ func (ec *executionContext) fieldContext_Query_directiveNullableArg(ctx context. return fc, nil } -func (ec *executionContext) _Query_directiveSingleNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_directiveSingleNullableArg(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp := ec._fieldMiddleware(ctx, nil, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().DirectiveSingleNullableArg(rctx, fc.Args["arg1"].(*string)) - }) - - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_directiveSingleNullableArg(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_directiveSingleNullableArg_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - func (ec *executionContext) _Query_directiveInputNullable(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query_directiveInputNullable(ctx, field) if err != nil { @@ -3407,52 +2643,43 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObject(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "order1_1") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order1 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order1 is not implemented") + return nil, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive0, location) } directive2 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "order1_2") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order1 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order1 is not implemented") + return nil, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive1, location) } directive3 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "order2_1") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order2 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order2 is not implemented") + return nil, errors.New("directive order2 is not implemented") } return ec.directives.Order2(ctx, nil, directive2, location) } directive4 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "Query_field") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order1 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order1 is not implemented") + return nil, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive3, location) } @@ -3558,21 +2785,17 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveFieldDef(rctx, fc.Args["ret"].(string)) } - directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, nil, directive0, min, nil, message) } @@ -3680,18 +2903,15 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveDouble(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive1 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive1 is not implemented") + return nil, errors.New("directive directive1 is not implemented") } return ec.directives.Directive1(ctx, nil, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive2 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive2 is not implemented") + return nil, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -3747,11 +2967,9 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveUnimplemented(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Unimplemented == nil { - var zeroVal *string - return zeroVal, errors.New("directive unimplemented is not implemented") + return nil, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -4023,11 +3241,9 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NoShape(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.MakeNil == nil { - var zeroVal Shape - return zeroVal, errors.New("directive makeNil is not implemented") + return nil, errors.New("directive makeNil is not implemented") } return ec.directives.MakeNil(ctx, nil, directive0) } @@ -4124,11 +3340,9 @@ func (ec *executionContext) _Query_noShapeTypedNil(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NoShapeTypedNil(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.MakeTypedNil == nil { - var zeroVal Shape - return zeroVal, errors.New("directive makeTypedNil is not implemented") + return nil, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -4184,11 +3398,9 @@ func (ec *executionContext) _Query_animal(ctx context.Context, field graphql.Col ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Animal(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.MakeTypedNil == nil { - var zeroVal Animal - return zeroVal, errors.New("directive makeTypedNil is not implemented") + return nil, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -6071,18 +5283,15 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveDouble(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive1 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive1 is not implemented") + return nil, errors.New("directive directive1 is not implemented") } return ec.directives.Directive1(ctx, nil, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive2 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive2 is not implemented") + return nil, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -6152,11 +5361,9 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveUnimplemented(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Unimplemented == nil { - var zeroVal *string - return zeroVal, errors.New("directive unimplemented is not implemented") + return nil, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -7702,25 +6909,6 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "directiveSingleNullableArg": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_directiveSingleNullableArg(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "directiveInputNullable": field := field diff --git a/codegen/testserver/followschema/stub.go b/codegen/testserver/followschema/stub.go index ee9e7c245de..d9b2cc6d6ec 100644 --- a/codegen/testserver/followschema/stub.go +++ b/codegen/testserver/followschema/stub.go @@ -75,7 +75,6 @@ type Stub struct { DeferCase2 func(ctx context.Context) ([]*DeferModel, error) DirectiveArg func(ctx context.Context, arg string) (*string, error) DirectiveNullableArg func(ctx context.Context, arg *int, arg2 *int, arg3 *string) (*string, error) - DirectiveSingleNullableArg func(ctx context.Context, arg1 *string) (*string, error) DirectiveInputNullable func(ctx context.Context, arg *InputDirectives) (*string, error) DirectiveInput func(ctx context.Context, arg InputDirectives) (*string, error) DirectiveInputType func(ctx context.Context, arg InnerInput) (*string, error) @@ -364,9 +363,6 @@ func (r *stubQuery) DirectiveArg(ctx context.Context, arg string) (*string, erro func (r *stubQuery) DirectiveNullableArg(ctx context.Context, arg *int, arg2 *int, arg3 *string) (*string, error) { return r.QueryResolver.DirectiveNullableArg(ctx, arg, arg2, arg3) } -func (r *stubQuery) DirectiveSingleNullableArg(ctx context.Context, arg1 *string) (*string, error) { - return r.QueryResolver.DirectiveSingleNullableArg(ctx, arg1) -} func (r *stubQuery) DirectiveInputNullable(ctx context.Context, arg *InputDirectives) (*string, error) { return r.QueryResolver.DirectiveInputNullable(ctx, arg) } diff --git a/codegen/testserver/followschema/validtypes.generated.go b/codegen/testserver/followschema/validtypes.generated.go index 12759ac5eb2..ed5bfcc9075 100644 --- a/codegen/testserver/followschema/validtypes.generated.go +++ b/codegen/testserver/followschema/validtypes.generated.go @@ -22,741 +22,257 @@ import ( func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_ValidType_validArgs_argsBreak(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["break"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("break")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["break"] = arg0 - arg1, err := ec.field_ValidType_validArgs_argsDefault(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["default"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("default")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["default"] = arg1 - arg2, err := ec.field_ValidType_validArgs_argsFunc(ctx, rawArgs) - if err != nil { - return nil, err + var arg2 string + if tmp, ok := rawArgs["func"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("func")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["func"] = arg2 - arg3, err := ec.field_ValidType_validArgs_argsInterface(ctx, rawArgs) - if err != nil { - return nil, err + var arg3 string + if tmp, ok := rawArgs["interface"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interface")) + arg3, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["interface"] = arg3 - arg4, err := ec.field_ValidType_validArgs_argsSelect(ctx, rawArgs) - if err != nil { - return nil, err + var arg4 string + if tmp, ok := rawArgs["select"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("select")) + arg4, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["select"] = arg4 - arg5, err := ec.field_ValidType_validArgs_argsCase(ctx, rawArgs) - if err != nil { - return nil, err + var arg5 string + if tmp, ok := rawArgs["case"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("case")) + arg5, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["case"] = arg5 - arg6, err := ec.field_ValidType_validArgs_argsDefer(ctx, rawArgs) - if err != nil { - return nil, err + var arg6 string + if tmp, ok := rawArgs["defer"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defer")) + arg6, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["defer"] = arg6 - arg7, err := ec.field_ValidType_validArgs_argsGo(ctx, rawArgs) - if err != nil { - return nil, err + var arg7 string + if tmp, ok := rawArgs["go"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("go")) + arg7, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["go"] = arg7 - arg8, err := ec.field_ValidType_validArgs_argsMap(ctx, rawArgs) - if err != nil { - return nil, err + var arg8 string + if tmp, ok := rawArgs["map"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("map")) + arg8, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["map"] = arg8 - arg9, err := ec.field_ValidType_validArgs_argsStruct(ctx, rawArgs) - if err != nil { - return nil, err + var arg9 string + if tmp, ok := rawArgs["struct"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("struct")) + arg9, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["struct"] = arg9 - arg10, err := ec.field_ValidType_validArgs_argsChan(ctx, rawArgs) - if err != nil { - return nil, err + var arg10 string + if tmp, ok := rawArgs["chan"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("chan")) + arg10, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["chan"] = arg10 - arg11, err := ec.field_ValidType_validArgs_argsElse(ctx, rawArgs) - if err != nil { - return nil, err + var arg11 string + if tmp, ok := rawArgs["else"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("else")) + arg11, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["else"] = arg11 - arg12, err := ec.field_ValidType_validArgs_argsGoto(ctx, rawArgs) - if err != nil { - return nil, err + var arg12 string + if tmp, ok := rawArgs["goto"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("goto")) + arg12, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["goto"] = arg12 - arg13, err := ec.field_ValidType_validArgs_argsPackage(ctx, rawArgs) - if err != nil { - return nil, err + var arg13 string + if tmp, ok := rawArgs["package"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) + arg13, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["package"] = arg13 - arg14, err := ec.field_ValidType_validArgs_argsSwitch(ctx, rawArgs) - if err != nil { - return nil, err + var arg14 string + if tmp, ok := rawArgs["switch"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("switch")) + arg14, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["switch"] = arg14 - arg15, err := ec.field_ValidType_validArgs_argsConst(ctx, rawArgs) - if err != nil { - return nil, err + var arg15 string + if tmp, ok := rawArgs["const"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("const")) + arg15, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["const"] = arg15 - arg16, err := ec.field_ValidType_validArgs_argsFallthrough(ctx, rawArgs) - if err != nil { - return nil, err + var arg16 string + if tmp, ok := rawArgs["fallthrough"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough")) + arg16, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["fallthrough"] = arg16 - arg17, err := ec.field_ValidType_validArgs_argsIf(ctx, rawArgs) - if err != nil { - return nil, err + var arg17 string + if tmp, ok := rawArgs["if"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + arg17, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["if"] = arg17 - arg18, err := ec.field_ValidType_validArgs_argsRange(ctx, rawArgs) - if err != nil { - return nil, err + var arg18 string + if tmp, ok := rawArgs["range"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("range")) + arg18, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["range"] = arg18 - arg19, err := ec.field_ValidType_validArgs_argsType(ctx, rawArgs) - if err != nil { - return nil, err + var arg19 string + if tmp, ok := rawArgs["type"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + arg19, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["type"] = arg19 - arg20, err := ec.field_ValidType_validArgs_argsContinue(ctx, rawArgs) - if err != nil { - return nil, err + var arg20 string + if tmp, ok := rawArgs["continue"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("continue")) + arg20, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["continue"] = arg20 - arg21, err := ec.field_ValidType_validArgs_argsFor(ctx, rawArgs) - if err != nil { - return nil, err + var arg21 string + if tmp, ok := rawArgs["for"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("for")) + arg21, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["for"] = arg21 - arg22, err := ec.field_ValidType_validArgs_argsImport(ctx, rawArgs) - if err != nil { - return nil, err + var arg22 string + if tmp, ok := rawArgs["import"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) + arg22, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["import"] = arg22 - arg23, err := ec.field_ValidType_validArgs_argsReturn(ctx, rawArgs) - if err != nil { - return nil, err + var arg23 string + if tmp, ok := rawArgs["return"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("return")) + arg23, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["return"] = arg23 - arg24, err := ec.field_ValidType_validArgs_argsVar(ctx, rawArgs) - if err != nil { - return nil, err + var arg24 string + if tmp, ok := rawArgs["var"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("var")) + arg24, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["var"] = arg24 - arg25, err := ec.field_ValidType_validArgs_args_(ctx, rawArgs) - if err != nil { - return nil, err + var arg25 string + if tmp, ok := rawArgs["_"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("_")) + arg25, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["_"] = arg25 return args, nil } -func (ec *executionContext) field_ValidType_validArgs_argsBreak( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["break"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("break")) - if tmp, ok := rawArgs["break"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsDefault( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["default"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("default")) - if tmp, ok := rawArgs["default"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsFunc( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["func"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("func")) - if tmp, ok := rawArgs["func"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsInterface( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["interface"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("interface")) - if tmp, ok := rawArgs["interface"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsSelect( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["select"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("select")) - if tmp, ok := rawArgs["select"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsCase( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["case"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("case")) - if tmp, ok := rawArgs["case"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsDefer( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["defer"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("defer")) - if tmp, ok := rawArgs["defer"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsGo( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["go"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("go")) - if tmp, ok := rawArgs["go"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsMap( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["map"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("map")) - if tmp, ok := rawArgs["map"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsStruct( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["struct"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("struct")) - if tmp, ok := rawArgs["struct"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsChan( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["chan"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("chan")) - if tmp, ok := rawArgs["chan"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsElse( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["else"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("else")) - if tmp, ok := rawArgs["else"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsGoto( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["goto"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("goto")) - if tmp, ok := rawArgs["goto"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsPackage( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["package"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) - if tmp, ok := rawArgs["package"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsSwitch( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["switch"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("switch")) - if tmp, ok := rawArgs["switch"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsConst( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["const"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("const")) - if tmp, ok := rawArgs["const"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsFallthrough( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["fallthrough"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough")) - if tmp, ok := rawArgs["fallthrough"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsIf( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["if"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - if tmp, ok := rawArgs["if"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsRange( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["range"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("range")) - if tmp, ok := rawArgs["range"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsType( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["type"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - if tmp, ok := rawArgs["type"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsContinue( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["continue"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("continue")) - if tmp, ok := rawArgs["continue"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsFor( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["for"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("for")) - if tmp, ok := rawArgs["for"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsImport( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["import"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) - if tmp, ok := rawArgs["import"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsReturn( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["return"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("return")) - if tmp, ok := rawArgs["return"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsVar( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["var"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("var")) - if tmp, ok := rawArgs["var"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_args_( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["_"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("_")) - if tmp, ok := rawArgs["_"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_ValidType_validInputKeywords_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *ValidInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐValidInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_ValidType_validInputKeywords_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*ValidInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *ValidInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐValidInput(ctx, tmp) - } - - var zeroVal *ValidInput - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/codegen/testserver/followschema/variadic.generated.go b/codegen/testserver/followschema/variadic.generated.go index 357b04912ac..a49df6776a6 100644 --- a/codegen/testserver/followschema/variadic.generated.go +++ b/codegen/testserver/followschema/variadic.generated.go @@ -21,34 +21,17 @@ import ( func (ec *executionContext) field_VariadicModel_value_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_VariadicModel_value_argsRank(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["rank"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rank")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["rank"] = arg0 return args, nil } -func (ec *executionContext) field_VariadicModel_value_argsRank( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["rank"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("rank")) - if tmp, ok := rawArgs["rank"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/codegen/testserver/followschema/wrapped_type.generated.go b/codegen/testserver/followschema/wrapped_type.generated.go index c06592ceaa5..538e2acb382 100644 --- a/codegen/testserver/followschema/wrapped_type.generated.go +++ b/codegen/testserver/followschema/wrapped_type.generated.go @@ -29,66 +29,32 @@ type WrappedSliceResolver interface { func (ec *executionContext) field_WrappedMap_get_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_WrappedMap_get_argsKey(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["key"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["key"] = arg0 return args, nil } -func (ec *executionContext) field_WrappedMap_get_argsKey( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["key"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) - if tmp, ok := rawArgs["key"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_WrappedSlice_get_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_WrappedSlice_get_argsIdx(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["idx"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idx")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["idx"] = arg0 return args, nil } -func (ec *executionContext) field_WrappedSlice_get_argsIdx( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["idx"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("idx")) - if tmp, ok := rawArgs["idx"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/codegen/testserver/nullabledirectives/directive.graphql b/codegen/testserver/nullabledirectives/directive.graphql deleted file mode 100644 index 44caa8eee25..00000000000 --- a/codegen/testserver/nullabledirectives/directive.graphql +++ /dev/null @@ -1,8 +0,0 @@ -directive @populate(value: String!) on ARGUMENT_DEFINITION -directive @noop on ARGUMENT_DEFINITION - -type Query { - directiveSingleNullableArg( - arg1: String @populate(value: "test") @noop, - ): String -} diff --git a/codegen/testserver/nullabledirectives/directive_test.go b/codegen/testserver/nullabledirectives/directive_test.go deleted file mode 100644 index 9d24fa6fe26..00000000000 --- a/codegen/testserver/nullabledirectives/directive_test.go +++ /dev/null @@ -1,75 +0,0 @@ -//go:generate go run ../../../testdata/gqlgen.go -config gqlgen.yml -stub stub.go - -package followschema - -import ( - "context" - "reflect" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/99designs/gqlgen/client" - "github.com/99designs/gqlgen/codegen/testserver/nullabledirectives/generated" - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/handler" -) - -// isNil checks if the given value is nil -func isNil(input any) bool { - if input == nil { - return true - } - // Using reflect to check if the value is nil. This is necessary for - // for any types that are not nil types but have a nil value (e.g. *string). - value := reflect.ValueOf(input) - return value.IsNil() -} - -func TestDirectives(t *testing.T) { - resolvers := &Stub{} - ok := "Ok" - resolvers.QueryResolver.DirectiveSingleNullableArg = func(ctx context.Context, arg1 *string) (*string, error) { - if arg1 != nil { - return arg1, nil - } - - return &ok, nil - } - - srv := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{ - Resolvers: resolvers, - Directives: generated.DirectiveRoot{ - Populate: func(ctx context.Context, obj any, next graphql.Resolver, value string) (any, error) { - res, err := next(ctx) - if err != nil { - return nil, err - } - - if !isNil(res) { - return res, err - } - - return &value, nil - }, - Noop: func(ctx context.Context, obj any, next graphql.Resolver) (any, error) { - return next(ctx) - }, - }, - })) - - c := client.New(srv) - - t.Run("arg directives", func(t *testing.T) { - t.Run("directive is called with null arguments", func(t *testing.T) { - var resp struct { - DirectiveSingleNullableArg *string - } - - err := c.Post(`query { directiveSingleNullableArg }`, &resp) - - require.NoError(t, err) - require.Equal(t, "test", *resp.DirectiveSingleNullableArg) - }) - }) -} diff --git a/codegen/testserver/nullabledirectives/generated/directive.generated.go b/codegen/testserver/nullabledirectives/generated/directive.generated.go deleted file mode 100644 index 63dcc26efa9..00000000000 --- a/codegen/testserver/nullabledirectives/generated/directive.generated.go +++ /dev/null @@ -1,416 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package generated - -import ( - "context" - "errors" - "fmt" - "strconv" - "sync/atomic" - - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/introspection" - "github.com/vektah/gqlparser/v2/ast" -) - -// region ************************** generated!.gotpl ************************** - -type QueryResolver interface { - DirectiveSingleNullableArg(ctx context.Context, arg1 *string) (*string, error) -} - -// endregion ************************** generated!.gotpl ************************** - -// region ***************************** args.gotpl ***************************** - -func (ec *executionContext) dir_populate_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.dir_populate_argsValue(ctx, rawArgs) - if err != nil { - return nil, err - } - args["value"] = arg0 - return args, nil -} -func (ec *executionContext) dir_populate_argsValue( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["value"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) - if tmp, ok := rawArgs["value"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err - } - args["name"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Query_directiveSingleNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveSingleNullableArg_argsArg1(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg1"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_directiveSingleNullableArg_argsArg1( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg1")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg1"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - directive1 := func(ctx context.Context) (interface{}, error) { - value, err := ec.unmarshalNString2string(ctx, "test") - if err != nil { - var zeroVal *string - return zeroVal, err - } - if ec.directives.Populate == nil { - var zeroVal *string - return zeroVal, errors.New("directive populate is not implemented") - } - return ec.directives.Populate(ctx, rawArgs, directive0, value) - } - directive2 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Noop == nil { - var zeroVal *string - return zeroVal, errors.New("directive noop is not implemented") - } - return ec.directives.Noop(ctx, rawArgs, directive1) - } - - tmp, err := directive2(ctx) - if err != nil { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*string); ok { - return data, nil - } else if tmp == nil { - var zeroVal *string - return zeroVal, nil - } else { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) - } -} - -// endregion ***************************** args.gotpl ***************************** - -// region ************************** directives.gotpl ************************** - -// endregion ************************** directives.gotpl ************************** - -// region **************************** field.gotpl ***************************** - -func (ec *executionContext) _Query_directiveSingleNullableArg(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query_directiveSingleNullableArg(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.resolvers.Query().DirectiveSingleNullableArg(rctx, fc.Args["arg1"].(*string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query_directiveSingleNullableArg(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: true, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query_directiveSingleNullableArg_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectType(fc.Args["name"].(string)) - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query___type(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field_Query___type_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) _Query___schema(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_Query___schema(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return ec.introspectSchema() - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Schema) - fc.Result = res - return ec.marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext_Query___schema(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "Query", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "description": - return ec.fieldContext___Schema_description(ctx, field) - case "types": - return ec.fieldContext___Schema_types(ctx, field) - case "queryType": - return ec.fieldContext___Schema_queryType(ctx, field) - case "mutationType": - return ec.fieldContext___Schema_mutationType(ctx, field) - case "subscriptionType": - return ec.fieldContext___Schema_subscriptionType(ctx, field) - case "directives": - return ec.fieldContext___Schema_directives(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Schema", field.Name) - }, - } - return fc, nil -} - -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -var queryImplementors = []string{"Query"} - -func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, queryImplementors) - ctx = graphql.WithFieldContext(ctx, &graphql.FieldContext{ - Object: "Query", - }) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - innerCtx := graphql.WithRootFieldContext(ctx, &graphql.RootFieldContext{ - Object: field.Name, - Field: field, - }) - - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("Query") - case "directiveSingleNullableArg": - field := field - - innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - } - }() - res = ec._Query_directiveSingleNullableArg(ctx, field) - return res - } - - rrm := func(ctx context.Context) graphql.Marshaler { - return ec.OperationContext.RootResolverMiddleware(ctx, - func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) - } - - out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) - case "__type": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___type(ctx, field) - }) - case "__schema": - out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { - return ec._Query___schema(ctx, field) - }) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -// endregion **************************** object.gotpl **************************** - -// region ***************************** type.gotpl ***************************** - -// endregion ***************************** type.gotpl ***************************** diff --git a/codegen/testserver/nullabledirectives/generated/models/models-gen.go b/codegen/testserver/nullabledirectives/generated/models/models-gen.go deleted file mode 100644 index 3b1a4d208a9..00000000000 --- a/codegen/testserver/nullabledirectives/generated/models/models-gen.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package models - -type Query struct { -} diff --git a/codegen/testserver/nullabledirectives/generated/prelude.generated.go b/codegen/testserver/nullabledirectives/generated/prelude.generated.go deleted file mode 100644 index bf9faab9ab1..00000000000 --- a/codegen/testserver/nullabledirectives/generated/prelude.generated.go +++ /dev/null @@ -1,2771 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package generated - -import ( - "context" - "errors" - "fmt" - "strconv" - "sync" - "sync/atomic" - - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/introspection" - "github.com/vektah/gqlparser/v2/ast" -) - -// region ************************** generated!.gotpl ************************** - -// endregion ************************** generated!.gotpl ************************** - -// region ***************************** args.gotpl ***************************** - -func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) - if err != nil { - return nil, err - } - args["if"] = arg0 - arg1, err := ec.dir_defer_argsLabel(ctx, rawArgs) - if err != nil { - return nil, err - } - args["label"] = arg1 - return args, nil -} -func (ec *executionContext) dir_defer_argsIf( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["if"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - if tmp, ok := rawArgs["if"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} - -func (ec *executionContext) dir_defer_argsLabel( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["label"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) - if tmp, ok := rawArgs["label"]; ok { - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} - -func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err - } - args["includeDeprecated"] = arg0 - return args, nil -} -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} - -func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { - var err error - args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err - } - args["includeDeprecated"] = arg0 - return args, nil -} -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} - -// endregion ***************************** args.gotpl ***************************** - -// region ************************** directives.gotpl ************************** - -// endregion ************************** directives.gotpl ************************** - -// region **************************** field.gotpl ***************************** - -func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !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) fieldContext___Directive_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_locations(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_locations(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Locations, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]string) - fc.Result = res - return ec.marshalN__DirectiveLocation2ᚕstringᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_locations(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __DirectiveLocation does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_args(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Directive_isRepeatable(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Directive_isRepeatable(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsRepeatable, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Directive_isRepeatable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Directive", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !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) fieldContext___EnumValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_isDeprecated(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___EnumValue_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.EnumValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___EnumValue_deprecationReason(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___EnumValue_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__EnumValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !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) fieldContext___Field_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_args(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_args(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Args, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_args(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_type(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_isDeprecated(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_isDeprecated(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.IsDeprecated(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(bool) - fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_isDeprecated(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Field_deprecationReason(ctx context.Context, field graphql.CollectedField, obj *introspection.Field) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Field_deprecationReason(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DeprecationReason(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Field_deprecationReason(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Field", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_name(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !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) fieldContext___InputValue_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_description(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_type(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_type(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Type, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_type(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___InputValue_defaultValue(ctx context.Context, field graphql.CollectedField, obj *introspection.InputValue) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___InputValue_defaultValue(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.DefaultValue, nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___InputValue_defaultValue(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__InputValue", - Field: field, - IsMethod: false, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_types(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_types(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Types(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_types(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_queryType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_queryType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.QueryType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_queryType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_mutationType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_mutationType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.MutationType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_mutationType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_subscriptionType(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_subscriptionType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SubscriptionType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_subscriptionType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Schema_directives(ctx context.Context, field graphql.CollectedField, obj *introspection.Schema) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Schema_directives(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Directives(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.([]introspection.Directive) - fc.Result = res - return ec.marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Schema_directives(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Schema", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Directive_name(ctx, field) - case "description": - return ec.fieldContext___Directive_description(ctx, field) - case "locations": - return ec.fieldContext___Directive_locations(ctx, field) - case "args": - return ec.fieldContext___Directive_args(ctx, field) - case "isRepeatable": - return ec.fieldContext___Directive_isRepeatable(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Directive", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_kind(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_kind(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Kind(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } - return graphql.Null - } - res := resTmp.(string) - fc.Result = res - return ec.marshalN__TypeKind2string(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_kind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type __TypeKind does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_name(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Name(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_description(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_description(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Description(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_fields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_fields(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Fields(fc.Args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Field) - fc.Result = res - return ec.marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_fields(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___Field_name(ctx, field) - case "description": - return ec.fieldContext___Field_description(ctx, field) - case "args": - return ec.fieldContext___Field_args(ctx, field) - case "type": - return ec.fieldContext___Field_type(ctx, field) - case "isDeprecated": - return ec.fieldContext___Field_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___Field_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Field", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_fields_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) ___Type_interfaces(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_interfaces(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.Interfaces(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_interfaces(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_possibleTypes(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_possibleTypes(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.PossibleTypes(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_possibleTypes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_enumValues(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_enumValues(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.EnumValues(fc.Args["includeDeprecated"].(bool)), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.EnumValue) - fc.Result = res - return ec.marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_enumValues(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___EnumValue_name(ctx, field) - case "description": - return ec.fieldContext___EnumValue_description(ctx, field) - case "isDeprecated": - return ec.fieldContext___EnumValue_isDeprecated(ctx, field) - case "deprecationReason": - return ec.fieldContext___EnumValue_deprecationReason(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __EnumValue", field.Name) - }, - } - defer func() { - if r := recover(); r != nil { - err = ec.Recover(ctx, r) - ec.Error(ctx, err) - } - }() - ctx = graphql.WithFieldContext(ctx, fc) - if fc.Args, err = ec.field___Type_enumValues_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { - ec.Error(ctx, err) - return fc, err - } - return fc, nil -} - -func (ec *executionContext) ___Type_inputFields(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_inputFields(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.InputFields(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.([]introspection.InputValue) - fc.Result = res - return ec.marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_inputFields(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext___InputValue_name(ctx, field) - case "description": - return ec.fieldContext___InputValue_description(ctx, field) - case "type": - return ec.fieldContext___InputValue_type(ctx, field) - case "defaultValue": - return ec.fieldContext___InputValue_defaultValue(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __InputValue", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_ofType(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_ofType(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.OfType(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*introspection.Type) - fc.Result = res - return ec.marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_ofType(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "kind": - return ec.fieldContext___Type_kind(ctx, field) - case "name": - return ec.fieldContext___Type_name(ctx, field) - case "description": - return ec.fieldContext___Type_description(ctx, field) - case "fields": - return ec.fieldContext___Type_fields(ctx, field) - case "interfaces": - return ec.fieldContext___Type_interfaces(ctx, field) - case "possibleTypes": - return ec.fieldContext___Type_possibleTypes(ctx, field) - case "enumValues": - return ec.fieldContext___Type_enumValues(ctx, field) - case "inputFields": - return ec.fieldContext___Type_inputFields(ctx, field) - case "ofType": - return ec.fieldContext___Type_ofType(ctx, field) - case "specifiedByURL": - return ec.fieldContext___Type_specifiedByURL(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type __Type", field.Name) - }, - } - return fc, nil -} - -func (ec *executionContext) ___Type_specifiedByURL(ctx context.Context, field graphql.CollectedField, obj *introspection.Type) (ret graphql.Marshaler) { - fc, err := ec.fieldContext___Type_specifiedByURL(ctx, field) - if err != nil { - return graphql.Null - } - ctx = graphql.WithFieldContext(ctx, fc) - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = graphql.Null - } - }() - resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { - ctx = rctx // use context from middleware stack in children - return obj.SpecifiedByURL(), nil - }) - if err != nil { - ec.Error(ctx, err) - return graphql.Null - } - if resTmp == nil { - return graphql.Null - } - res := resTmp.(*string) - fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) -} - -func (ec *executionContext) fieldContext___Type_specifiedByURL(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { - fc = &graphql.FieldContext{ - Object: "__Type", - Field: field, - IsMethod: true, - IsResolver: false, - Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") - }, - } - return fc, nil -} - -// endregion **************************** field.gotpl ***************************** - -// region **************************** input.gotpl ***************************** - -// endregion **************************** input.gotpl ***************************** - -// region ************************** interface.gotpl *************************** - -// endregion ************************** interface.gotpl *************************** - -// region **************************** object.gotpl **************************** - -var __DirectiveImplementors = []string{"__Directive"} - -func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __DirectiveImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Directive") - case "name": - out.Values[i] = ec.___Directive_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___Directive_description(ctx, field, obj) - case "locations": - out.Values[i] = ec.___Directive_locations(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "args": - out.Values[i] = ec.___Directive_args(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "isRepeatable": - out.Values[i] = ec.___Directive_isRepeatable(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var __EnumValueImplementors = []string{"__EnumValue"} - -func (ec *executionContext) ___EnumValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.EnumValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __EnumValueImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__EnumValue") - case "name": - out.Values[i] = ec.___EnumValue_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___EnumValue_description(ctx, field, obj) - case "isDeprecated": - out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___EnumValue_deprecationReason(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var __FieldImplementors = []string{"__Field"} - -func (ec *executionContext) ___Field(ctx context.Context, sel ast.SelectionSet, obj *introspection.Field) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __FieldImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Field") - case "name": - out.Values[i] = ec.___Field_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___Field_description(ctx, field, obj) - case "args": - out.Values[i] = ec.___Field_args(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "type": - out.Values[i] = ec.___Field_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "isDeprecated": - out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "deprecationReason": - out.Values[i] = ec.___Field_deprecationReason(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var __InputValueImplementors = []string{"__InputValue"} - -func (ec *executionContext) ___InputValue(ctx context.Context, sel ast.SelectionSet, obj *introspection.InputValue) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __InputValueImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__InputValue") - case "name": - out.Values[i] = ec.___InputValue_name(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "description": - out.Values[i] = ec.___InputValue_description(ctx, field, obj) - case "type": - out.Values[i] = ec.___InputValue_type(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "defaultValue": - out.Values[i] = ec.___InputValue_defaultValue(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var __SchemaImplementors = []string{"__Schema"} - -func (ec *executionContext) ___Schema(ctx context.Context, sel ast.SelectionSet, obj *introspection.Schema) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __SchemaImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Schema") - case "description": - out.Values[i] = ec.___Schema_description(ctx, field, obj) - case "types": - out.Values[i] = ec.___Schema_types(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "queryType": - out.Values[i] = ec.___Schema_queryType(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "mutationType": - out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) - case "subscriptionType": - out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) - case "directives": - out.Values[i] = ec.___Schema_directives(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -var __TypeImplementors = []string{"__Type"} - -func (ec *executionContext) ___Type(ctx context.Context, sel ast.SelectionSet, obj *introspection.Type) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, __TypeImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("__Type") - case "kind": - out.Values[i] = ec.___Type_kind(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "name": - out.Values[i] = ec.___Type_name(ctx, field, obj) - case "description": - out.Values[i] = ec.___Type_description(ctx, field, obj) - case "fields": - out.Values[i] = ec.___Type_fields(ctx, field, obj) - case "interfaces": - out.Values[i] = ec.___Type_interfaces(ctx, field, obj) - case "possibleTypes": - out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) - case "enumValues": - out.Values[i] = ec.___Type_enumValues(ctx, field, obj) - case "inputFields": - out.Values[i] = ec.___Type_inputFields(ctx, field, obj) - case "ofType": - out.Values[i] = ec.___Type_ofType(ctx, field, obj) - case "specifiedByURL": - out.Values[i] = ec.___Type_specifiedByURL(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - -// endregion **************************** object.gotpl **************************** - -// region ***************************** type.gotpl ***************************** - -func (ec *executionContext) unmarshalNBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - res, err := graphql.UnmarshalBoolean(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { - res := graphql.MarshalBoolean(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -func (ec *executionContext) unmarshalNString2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalNString2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { - return ec.___Directive(ctx, sel, &v) -} - -func (ec *executionContext) marshalN__Directive2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirectiveᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Directive) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) unmarshalN__DirectiveLocation2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalN__DirectiveLocation2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -func (ec *executionContext) unmarshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, v interface{}) ([]string, error) { - var vSlice []interface{} - if v != nil { - vSlice = graphql.CoerceList(v) - } - var err error - res := make([]string, len(vSlice)) - for i := range vSlice { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithIndex(i)) - res[i], err = ec.unmarshalN__DirectiveLocation2string(ctx, vSlice[i]) - if err != nil { - return nil, err - } - } - return res, nil -} - -func (ec *executionContext) marshalN__DirectiveLocation2ᚕstringᚄ(ctx context.Context, sel ast.SelectionSet, v []string) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__DirectiveLocation2string(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx context.Context, sel ast.SelectionSet, v introspection.EnumValue) graphql.Marshaler { - return ec.___EnumValue(ctx, sel, &v) -} - -func (ec *executionContext) marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx context.Context, sel ast.SelectionSet, v introspection.Field) graphql.Marshaler { - return ec.___Field(ctx, sel, &v) -} - -func (ec *executionContext) marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx context.Context, sel ast.SelectionSet, v introspection.InputValue) graphql.Marshaler { - return ec.___InputValue(ctx, sel, &v) -} - -func (ec *executionContext) marshalN__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v introspection.Type) graphql.Marshaler { - return ec.___Type(ctx, sel, &v) -} - -func (ec *executionContext) marshalN__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalN__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec.___Type(ctx, sel, v) -} - -func (ec *executionContext) unmarshalN__TypeKind2string(ctx context.Context, v interface{}) (string, error) { - res, err := graphql.UnmarshalString(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalN__TypeKind2string(ctx context.Context, sel ast.SelectionSet, v string) graphql.Marshaler { - res := graphql.MarshalString(v) - if res == graphql.Null { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - } - return res -} - -func (ec *executionContext) unmarshalOBoolean2bool(ctx context.Context, v interface{}) (bool, error) { - res, err := graphql.UnmarshalBoolean(v) - return res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOBoolean2bool(ctx context.Context, sel ast.SelectionSet, v bool) graphql.Marshaler { - res := graphql.MarshalBoolean(v) - return res -} - -func (ec *executionContext) unmarshalOBoolean2ᚖbool(ctx context.Context, v interface{}) (*bool, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalBoolean(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOBoolean2ᚖbool(ctx context.Context, sel ast.SelectionSet, v *bool) graphql.Marshaler { - if v == nil { - return graphql.Null - } - res := graphql.MarshalBoolean(*v) - return res -} - -func (ec *executionContext) unmarshalOString2ᚖstring(ctx context.Context, v interface{}) (*string, error) { - if v == nil { - return nil, nil - } - res, err := graphql.UnmarshalString(v) - return &res, graphql.ErrorOnPath(ctx, err) -} - -func (ec *executionContext) marshalOString2ᚖstring(ctx context.Context, sel ast.SelectionSet, v *string) graphql.Marshaler { - if v == nil { - return graphql.Null - } - res := graphql.MarshalString(*v) - return res -} - -func (ec *executionContext) marshalO__EnumValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.EnumValue) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__EnumValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐEnumValue(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalO__Field2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐFieldᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Field) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__Field2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐField(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalO__InputValue2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValueᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.InputValue) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__InputValue2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐInputValue(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalO__Schema2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐSchema(ctx context.Context, sel ast.SelectionSet, v *introspection.Schema) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec.___Schema(ctx, sel, v) -} - -func (ec *executionContext) marshalO__Type2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐTypeᚄ(ctx context.Context, sel ast.SelectionSet, v []introspection.Type) graphql.Marshaler { - if v == nil { - return graphql.Null - } - ret := make(graphql.Array, len(v)) - var wg sync.WaitGroup - isLen1 := len(v) == 1 - if !isLen1 { - wg.Add(len(v)) - } - for i := range v { - i := i - fc := &graphql.FieldContext{ - Index: &i, - Result: &v[i], - } - ctx := graphql.WithFieldContext(ctx, fc) - f := func(i int) { - defer func() { - if r := recover(); r != nil { - ec.Error(ctx, ec.Recover(ctx, r)) - ret = nil - } - }() - if !isLen1 { - defer wg.Done() - } - ret[i] = ec.marshalN__Type2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx, sel, v[i]) - } - if isLen1 { - f(i) - } else { - go f(i) - } - - } - wg.Wait() - - for _, e := range ret { - if e == graphql.Null { - return graphql.Null - } - } - - return ret -} - -func (ec *executionContext) marshalO__Type2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐType(ctx context.Context, sel ast.SelectionSet, v *introspection.Type) graphql.Marshaler { - if v == nil { - return graphql.Null - } - return ec.___Type(ctx, sel, v) -} - -// endregion ***************************** type.gotpl ***************************** diff --git a/codegen/testserver/nullabledirectives/generated/resolvers/resolver.go b/codegen/testserver/nullabledirectives/generated/resolvers/resolver.go deleted file mode 100644 index 7308cae6cb2..00000000000 --- a/codegen/testserver/nullabledirectives/generated/resolvers/resolver.go +++ /dev/null @@ -1,21 +0,0 @@ -package resolver - -// THIS CODE IS A STARTING POINT ONLY. IT WILL NOT BE UPDATED WITH SCHEMA CHANGES. - -import ( - "context" - - nullabledirectives "github.com/99designs/gqlgen/codegen/testserver/nullabledirectives/generated" -) - -type Resolver struct{} - -// DirectiveSingleNullableArg is the resolver for the directiveSingleNullableArg field. -func (r *queryResolver) DirectiveSingleNullableArg(ctx context.Context, arg1 *string) (*string, error) { - panic("not implemented") -} - -// Query returns nullabledirectives.QueryResolver implementation. -func (r *Resolver) Query() nullabledirectives.QueryResolver { return &queryResolver{r} } - -type queryResolver struct{ *Resolver } diff --git a/codegen/testserver/nullabledirectives/generated/root_.generated.go b/codegen/testserver/nullabledirectives/generated/root_.generated.go deleted file mode 100644 index 717c9030bfd..00000000000 --- a/codegen/testserver/nullabledirectives/generated/root_.generated.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package generated - -import ( - "bytes" - "context" - "errors" - "sync/atomic" - - "github.com/99designs/gqlgen/graphql" - "github.com/99designs/gqlgen/graphql/introspection" - gqlparser "github.com/vektah/gqlparser/v2" - "github.com/vektah/gqlparser/v2/ast" -) - -// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface. -func NewExecutableSchema(cfg Config) graphql.ExecutableSchema { - return &executableSchema{ - schema: cfg.Schema, - resolvers: cfg.Resolvers, - directives: cfg.Directives, - complexity: cfg.Complexity, - } -} - -type Config struct { - Schema *ast.Schema - Resolvers ResolverRoot - Directives DirectiveRoot - Complexity ComplexityRoot -} - -type ResolverRoot interface { - Query() QueryResolver -} - -type DirectiveRoot struct { - Noop func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error) - Populate func(ctx context.Context, obj interface{}, next graphql.Resolver, value string) (res interface{}, err error) -} - -type ComplexityRoot struct { - Query struct { - DirectiveSingleNullableArg func(childComplexity int, arg1 *string) int - } -} - -type executableSchema struct { - schema *ast.Schema - resolvers ResolverRoot - directives DirectiveRoot - complexity ComplexityRoot -} - -func (e *executableSchema) Schema() *ast.Schema { - if e.schema != nil { - return e.schema - } - return parsedSchema -} - -func (e *executableSchema) Complexity(typeName, field string, childComplexity int, rawArgs map[string]interface{}) (int, bool) { - ec := executionContext{nil, e, 0, 0, nil} - _ = ec - switch typeName + "." + field { - - case "Query.directiveSingleNullableArg": - if e.complexity.Query.DirectiveSingleNullableArg == nil { - break - } - - args, err := ec.field_Query_directiveSingleNullableArg_args(context.TODO(), rawArgs) - if err != nil { - return 0, false - } - - return e.complexity.Query.DirectiveSingleNullableArg(childComplexity, args["arg1"].(*string)), true - - } - return 0, false -} - -func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} - inputUnmarshalMap := graphql.BuildUnmarshalerMap() - first := true - - switch rc.Operation.Operation { - case ast.Query: - return func(ctx context.Context) *graphql.Response { - var response graphql.Response - var data graphql.Marshaler - if first { - first = false - ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) - } else { - if atomic.LoadInt32(&ec.pendingDeferred) > 0 { - result := <-ec.deferredResults - atomic.AddInt32(&ec.pendingDeferred, -1) - data = result.Result - response.Path = result.Path - response.Label = result.Label - response.Errors = result.Errors - } else { - return nil - } - } - var buf bytes.Buffer - data.MarshalGQL(&buf) - response.Data = buf.Bytes() - if atomic.LoadInt32(&ec.deferred) > 0 { - hasNext := atomic.LoadInt32(&ec.pendingDeferred) > 0 - response.HasNext = &hasNext - } - - return &response - } - - default: - return graphql.OneShot(graphql.ErrorResponse(ctx, "unsupported GraphQL operation")) - } -} - -type executionContext struct { - *graphql.OperationContext - *executableSchema - deferred int32 - pendingDeferred int32 - deferredResults chan graphql.DeferredResult -} - -func (ec *executionContext) processDeferredGroup(dg graphql.DeferredGroup) { - atomic.AddInt32(&ec.pendingDeferred, 1) - go func() { - ctx := graphql.WithFreshResponseContext(dg.Context) - dg.FieldSet.Dispatch(ctx) - ds := graphql.DeferredResult{ - Path: dg.Path, - Label: dg.Label, - Result: dg.FieldSet, - Errors: graphql.GetErrors(ctx), - } - // null fields should bubble up - if dg.FieldSet.Invalids > 0 { - ds.Result = graphql.Null - } - ec.deferredResults <- ds - }() -} - -func (ec *executionContext) introspectSchema() (*introspection.Schema, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapSchema(ec.Schema()), nil -} - -func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { - if ec.DisableIntrospection { - return nil, errors.New("introspection disabled") - } - return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil -} - -var sources = []*ast.Source{ - {Name: "../directive.graphql", Input: `directive @populate(value: String!) on ARGUMENT_DEFINITION -directive @noop on ARGUMENT_DEFINITION - -type Query { - directiveSingleNullableArg( - arg1: String @populate(value: "test") @noop, - ): String -} -`, BuiltIn: false}, -} -var parsedSchema = gqlparser.MustLoadSchema(sources...) diff --git a/codegen/testserver/nullabledirectives/gqlgen.yml b/codegen/testserver/nullabledirectives/gqlgen.yml deleted file mode 100644 index 657e9d04123..00000000000 --- a/codegen/testserver/nullabledirectives/gqlgen.yml +++ /dev/null @@ -1,16 +0,0 @@ -schema: - - "*.graphql" -skip_validation: true -exec: - layout: follow-schema - dir: generated - package: generated -model: - filename: generated/models/models-gen.go - package: models -resolver: - filename: generated/resolvers/resolver.go - package: resolver - type: Resolver - -call_argument_directives_with_null: true diff --git a/codegen/testserver/nullabledirectives/stub.go b/codegen/testserver/nullabledirectives/stub.go deleted file mode 100644 index 507cfab34da..00000000000 --- a/codegen/testserver/nullabledirectives/stub.go +++ /dev/null @@ -1,25 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package followschema - -import ( - "context" - - "github.com/99designs/gqlgen/codegen/testserver/nullabledirectives/generated" -) - -type Stub struct { - QueryResolver struct { - DirectiveSingleNullableArg func(ctx context.Context, arg1 *string) (*string, error) - } -} - -func (r *Stub) Query() generated.QueryResolver { - return &stubQuery{r} -} - -type stubQuery struct{ *Stub } - -func (r *stubQuery) DirectiveSingleNullableArg(ctx context.Context, arg1 *string) (*string, error) { - return r.QueryResolver.DirectiveSingleNullableArg(ctx, arg1) -} diff --git a/codegen/testserver/singlefile/generated.go b/codegen/testserver/singlefile/generated.go index 70e707456ee..e7f91ec9516 100644 --- a/codegen/testserver/singlefile/generated.go +++ b/codegen/testserver/singlefile/generated.go @@ -2479,2594 +2479,1139 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) dir_defer_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["if"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["if"] = arg0 - arg1, err := ec.dir_defer_argsLabel(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *string + if tmp, ok := rawArgs["label"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) + arg1, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["label"] = arg1 return args, nil } -func (ec *executionContext) dir_defer_argsIf( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["if"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - if tmp, ok := rawArgs["if"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} - -func (ec *executionContext) dir_defer_argsLabel( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["label"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("label")) - if tmp, ok := rawArgs["label"]; ok { - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) dir_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_length_argsMin(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["min"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["min"] = arg0 - arg1, err := ec.dir_length_argsMax(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *int + if tmp, ok := rawArgs["max"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["max"] = arg1 - arg2, err := ec.dir_length_argsMessage(ctx, rawArgs) - if err != nil { - return nil, err + var arg2 *string + if tmp, ok := rawArgs["message"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("message")) + arg2, err = ec.unmarshalOString2ᚖstring(ctx, tmp) + if err != nil { + return nil, err + } } args["message"] = arg2 return args, nil } -func (ec *executionContext) dir_length_argsMin( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["min"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - if tmp, ok := rawArgs["min"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} - -func (ec *executionContext) dir_length_argsMax( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["max"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) - if tmp, ok := rawArgs["max"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} - -func (ec *executionContext) dir_length_argsMessage( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["message"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("message")) - if tmp, ok := rawArgs["message"]; ok { - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - - var zeroVal *string - return zeroVal, nil -} func (ec *executionContext) dir_logged_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_logged_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNUUID2string(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) dir_logged_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNUUID2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) dir_order1_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_order1_argsLocation(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["location"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["location"] = arg0 return args, nil } -func (ec *executionContext) dir_order1_argsLocation( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["location"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) - if tmp, ok := rawArgs["location"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) dir_order2_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_order2_argsLocation(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["location"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["location"] = arg0 return args, nil } -func (ec *executionContext) dir_order2_argsLocation( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["location"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("location")) - if tmp, ok := rawArgs["location"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_range_argsMin(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["min"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["min"] = arg0 - arg1, err := ec.dir_range_argsMax(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *int + if tmp, ok := rawArgs["max"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) + arg1, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["max"] = arg1 return args, nil } -func (ec *executionContext) dir_range_argsMin( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["min"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - if tmp, ok := rawArgs["min"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} - -func (ec *executionContext) dir_range_argsMax( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["max"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("max")) - if tmp, ok := rawArgs["max"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Mutation_defaultInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_defaultInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 DefaultInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNDefaultInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐDefaultInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_defaultInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (DefaultInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal DefaultInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNDefaultInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐDefaultInput(ctx, tmp) - } - - var zeroVal DefaultInput - return zeroVal, nil -} func (ec *executionContext) field_Mutation_overrideValueViaInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_overrideValueViaInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 FieldsOrderInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNFieldsOrderInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐFieldsOrderInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_overrideValueViaInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (FieldsOrderInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal FieldsOrderInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNFieldsOrderInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐFieldsOrderInput(ctx, tmp) - } - - var zeroVal FieldsOrderInput - return zeroVal, nil -} func (ec *executionContext) field_Mutation_updatePtrToPtr_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Mutation_updatePtrToPtr_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 UpdatePtrToPtrOuter + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNUpdatePtrToPtrOuter2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐUpdatePtrToPtrOuter(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_updatePtrToPtr_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (UpdatePtrToPtrOuter, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal UpdatePtrToPtrOuter - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNUpdatePtrToPtrOuter2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐUpdatePtrToPtrOuter(ctx, tmp) - } - - var zeroVal UpdatePtrToPtrOuter - return zeroVal, 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{}{} - arg0, err := ec.field_Mutation_updateSomething_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 SpecialInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐSpecialInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Mutation_updateSomething_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (SpecialInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal SpecialInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalNSpecialInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐSpecialInput(ctx, tmp) - } - - var zeroVal SpecialInput - return zeroVal, 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{}{} - arg0, err := ec.field_Panics_argUnmarshal_argsU(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []MarshalPanic + if tmp, ok := rawArgs["u"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMarshalPanicᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["u"] = arg0 return args, nil } -func (ec *executionContext) field_Panics_argUnmarshal_argsU( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]MarshalPanic, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["u"] - if !ok { - var zeroVal []MarshalPanic - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) - if tmp, ok := rawArgs["u"]; ok { - return ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMarshalPanicᚄ(ctx, tmp) - } - - var zeroVal []MarshalPanic - return zeroVal, nil -} func (ec *executionContext) field_Panics_fieldFuncMarshal_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Panics_fieldFuncMarshal_argsU(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []MarshalPanic + if tmp, ok := rawArgs["u"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) + arg0, err = ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMarshalPanicᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["u"] = arg0 return args, nil } -func (ec *executionContext) field_Panics_fieldFuncMarshal_argsU( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]MarshalPanic, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["u"] - if !ok { - var zeroVal []MarshalPanic - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("u")) - if tmp, ok := rawArgs["u"]; ok { - return ec.unmarshalNMarshalPanic2ᚕgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐMarshalPanicᚄ(ctx, tmp) - } - - var zeroVal []MarshalPanic - return zeroVal, nil -} func (ec *executionContext) field_Pet_friends_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Pet_friends_argsLimit(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["limit"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["limit"] = arg0 return args, nil } -func (ec *executionContext) field_Pet_friends_argsLimit( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["limit"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) - if tmp, ok := rawArgs["limit"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_defaultParameters_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_defaultParameters_argsFalsyBoolean(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["falsyBoolean"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("falsyBoolean")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["falsyBoolean"] = arg0 - arg1, err := ec.field_Query_defaultParameters_argsTruthyBoolean(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 *bool + if tmp, ok := rawArgs["truthyBoolean"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("truthyBoolean")) + arg1, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["truthyBoolean"] = arg1 return args, nil } -func (ec *executionContext) field_Query_defaultParameters_argsFalsyBoolean( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["falsyBoolean"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("falsyBoolean")) - if tmp, ok := rawArgs["falsyBoolean"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} - -func (ec *executionContext) field_Query_defaultParameters_argsTruthyBoolean( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["truthyBoolean"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("truthyBoolean")) - if tmp, ok := rawArgs["truthyBoolean"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} func (ec *executionContext) field_Query_defaultScalar_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_defaultScalar_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_defaultScalar_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNDefaultScalarImplementation2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_directiveArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 255) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") + if err != nil { + return nil, err + } + if ec.directives.Length == nil { + return nil, errors.New("directive length is not implemented") + } + return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - return ec.unmarshalNString2string(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalNInt2int(ctx, 1) + tmp, err = directive1(ctx) if err != nil { - var zeroVal string - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - max, err := ec.unmarshalOInt2ᚖint(ctx, 255) - if err != nil { - var zeroVal string - return zeroVal, err - } - message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") - if err != nil { - var zeroVal string - return zeroVal, err - } - if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + if data, ok := tmp.(string); ok { + arg0 = data + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } - return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(string); ok { - return data, nil - } else { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Query_directiveFieldDef_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveFieldDef_argsRet(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["ret"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ret")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["ret"] = arg0 return args, nil } -func (ec *executionContext) field_Query_directiveFieldDef_argsRet( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["ret"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("ret")) - if tmp, ok := rawArgs["ret"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveInputNullable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveInputNullable_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *InputDirectives + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInputDirectives(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_directiveInputNullable_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*InputDirectives, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *InputDirectives - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOInputDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInputDirectives(ctx, tmp) - } - - var zeroVal *InputDirectives - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveInputType_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveInputType_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Query_directiveInputType_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (InnerInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal InnerInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal InnerInput - return zeroVal, nil + var arg0 InnerInput + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + directive0 := func(ctx context.Context) (interface{}, error) { + return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInnerInput(ctx, tmp) } - return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInnerInput(ctx, tmp) - } - - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.Custom == nil { - var zeroVal InnerInput - return zeroVal, errors.New("directive custom is not implemented") + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.Custom == nil { + return nil, errors.New("directive custom is not implemented") + } + return ec.directives.Custom(ctx, rawArgs, directive0) } - return ec.directives.Custom(ctx, rawArgs, directive0) - } - tmp, err := directive1(ctx) - if err != nil { - var zeroVal InnerInput - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(InnerInput); ok { - return data, nil - } else { - var zeroVal InnerInput - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be github.com/99designs/gqlgen/codegen/testserver/singlefile.InnerInput`, tmp)) + tmp, err = directive1(ctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if data, ok := tmp.(InnerInput); ok { + arg0 = data + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be github.com/99designs/gqlgen/codegen/testserver/singlefile.InnerInput`, tmp)) + } } + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Query_directiveInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveInput_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 InputDirectives + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInputDirectives(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_directiveInput_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (InputDirectives, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal InputDirectives - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNInputDirectives2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInputDirectives(ctx, tmp) - } - - var zeroVal InputDirectives - return zeroVal, nil -} func (ec *executionContext) field_Query_directiveNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_directiveNullableArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - arg1, err := ec.field_Query_directiveNullableArg_argsArg2(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg2"] = arg1 - arg2, err := ec.field_Query_directiveNullableArg_argsArg3(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg3"] = arg2 - return args, nil -} -func (ec *executionContext) field_Query_directiveNullableArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg0 = data + } else if tmp == nil { + arg0 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Query_directiveNullableArg_argsArg2( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg2")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil + args["arg"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["arg2"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg1 = data + } else if tmp == nil { + arg1 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Query_directiveNullableArg_argsArg3( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg3")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil + args["arg2"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["arg3"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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") + } + return ec.directives.ToNull(ctx, rawArgs, directive0) } - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + tmp, err = directive1(ctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if data, ok := tmp.(*string); ok { + arg2 = data + } else if tmp == nil { + arg2 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } - return ec.directives.ToNull(ctx, rawArgs, directive0) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*string); ok { - return data, nil - } else if tmp == nil { - var zeroVal *string - return zeroVal, nil - } else { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } + args["arg3"] = arg2 + return args, nil } func (ec *executionContext) field_Query_enumInInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_enumInInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *InputWithEnumValue + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInputWithEnumValue(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_enumInInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*InputWithEnumValue, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *InputWithEnumValue - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOInputWithEnumValue2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInputWithEnumValue(ctx, tmp) - } - - var zeroVal *InputWithEnumValue - return zeroVal, nil -} func (ec *executionContext) field_Query_fallback_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_fallback_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 FallbackToStringEncoding + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐFallbackToStringEncoding(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_fallback_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (FallbackToStringEncoding, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal FallbackToStringEncoding - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNFallbackToStringEncoding2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐFallbackToStringEncoding(ctx, tmp) - } - - var zeroVal FallbackToStringEncoding - return zeroVal, nil -} func (ec *executionContext) field_Query_inputNullableSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_inputNullableSlice_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_inputNullableSlice_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal []string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOString2ᚕstringᚄ(ctx, tmp) - } - - var zeroVal []string - return zeroVal, nil -} func (ec *executionContext) field_Query_inputOmittable_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_inputOmittable_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 OmittableInput + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNOmittableInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐOmittableInput(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_inputOmittable_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (OmittableInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal OmittableInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNOmittableInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐOmittableInput(ctx, tmp) - } - - var zeroVal OmittableInput - return zeroVal, nil -} func (ec *executionContext) field_Query_inputSlice_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_inputSlice_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_inputSlice_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal []string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) - } - - var zeroVal []string - return zeroVal, nil -} func (ec *executionContext) field_Query_mapInput_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_mapInput_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 map[string]interface{} + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOChanges2map(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_mapInput_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOChanges2map(ctx, tmp) - } - - var zeroVal map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field_Query_mapNestedStringInterface_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_mapNestedStringInterface_argsIn(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *NestedMapInput + if tmp, ok := rawArgs["in"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) + arg0, err = ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐNestedMapInput(ctx, tmp) + if err != nil { + return nil, err + } } args["in"] = arg0 return args, nil } -func (ec *executionContext) field_Query_mapNestedStringInterface_argsIn( - ctx context.Context, - rawArgs map[string]interface{}, -) (*NestedMapInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["in"] - if !ok { - var zeroVal *NestedMapInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) - if tmp, ok := rawArgs["in"]; ok { - return ec.unmarshalONestedMapInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐNestedMapInput(ctx, tmp) - } - - var zeroVal *NestedMapInput - return zeroVal, nil -} func (ec *executionContext) field_Query_mapStringInterface_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_mapStringInterface_argsIn(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 map[string]interface{} + if tmp, ok := rawArgs["in"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) + arg0, err = ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) + if err != nil { + return nil, err + } } args["in"] = arg0 return args, nil } -func (ec *executionContext) field_Query_mapStringInterface_argsIn( - ctx context.Context, - rawArgs map[string]interface{}, -) (map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["in"] - if !ok { - var zeroVal map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("in")) - if tmp, ok := rawArgs["in"]; ok { - return ec.unmarshalOMapStringInterfaceInput2map(ctx, tmp) - } - - var zeroVal map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field_Query_nestedInputs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_nestedInputs_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 [][]*OuterInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐOuterInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_nestedInputs_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) ([][]*OuterInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal [][]*OuterInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOOuterInput2ᚕᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐOuterInput(ctx, tmp) - } - - var zeroVal [][]*OuterInput - return zeroVal, nil -} func (ec *executionContext) field_Query_nullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_nullableArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["arg"] = arg0 return args, nil } -func (ec *executionContext) field_Query_nullableArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - if tmp, ok := rawArgs["arg"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Query_recursive_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_recursive_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *RecursiveInputSlice + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐRecursiveInputSlice(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_Query_recursive_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*RecursiveInputSlice, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *RecursiveInputSlice - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalORecursiveInputSlice2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐRecursiveInputSlice(ctx, tmp) - } - - var zeroVal *RecursiveInputSlice - return zeroVal, nil -} func (ec *executionContext) field_Query_user_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_user_argsID(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["id"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["id"] = arg0 return args, nil } -func (ec *executionContext) field_Query_user_argsID( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["id"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) - if tmp, ok := rawArgs["id"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_Subscription_directiveArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Subscription_directiveArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - return args, nil -} -func (ec *executionContext) field_Subscription_directiveArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal string - return zeroVal, nil + var arg0 string + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + max, err := ec.unmarshalOInt2ᚖint(ctx, 255) + if err != nil { + return nil, err + } + message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") + if err != nil { + return nil, err + } + if ec.directives.Length == nil { + return nil, errors.New("directive length is not implemented") + } + return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) } - return ec.unmarshalNString2string(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalNInt2int(ctx, 1) - if err != nil { - var zeroVal string - return zeroVal, err - } - max, err := ec.unmarshalOInt2ᚖint(ctx, 255) + tmp, err = directive1(ctx) if err != nil { - var zeroVal string - return zeroVal, err - } - message, err := ec.unmarshalOString2ᚖstring(ctx, "invalid length") - if err != nil { - var zeroVal string - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + if data, ok := tmp.(string); ok { + arg0 = data + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } - return ec.directives.Length(ctx, rawArgs, directive0, min, max, message) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(string); ok { - return data, nil - } else { - var zeroVal string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be string`, tmp)) } + args["arg"] = arg0 + return args, nil } func (ec *executionContext) field_Subscription_directiveNullableArg_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Subscription_directiveNullableArg_argsArg(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg"] = arg0 - arg1, err := ec.field_Subscription_directiveNullableArg_argsArg2(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg2"] = arg1 - arg2, err := ec.field_Subscription_directiveNullableArg_argsArg3(ctx, rawArgs) - if err != nil { - return nil, err - } - args["arg3"] = arg2 - return args, nil -} -func (ec *executionContext) field_Subscription_directiveNullableArg_argsArg( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg"] - if !ok { - var zeroVal *int - return zeroVal, nil + var arg0 *int + if tmp, ok := rawArgs["arg"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg0 = data + } else if tmp == nil { + arg0 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Subscription_directiveNullableArg_argsArg2( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg2")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg2"] - if !ok { - var zeroVal *int - return zeroVal, nil + args["arg"] = arg0 + var arg1 *int + if tmp, ok := rawArgs["arg2"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { + return nil, err + } + if ec.directives.Range == nil { + return nil, errors.New("directive range is not implemented") + } + return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - min, err := ec.unmarshalOInt2ᚖint(ctx, 0) + tmp, err = directive1(ctx) if err != nil { - var zeroVal *int - return zeroVal, err + return nil, graphql.ErrorOnPath(ctx, err) } - if ec.directives.Range == nil { - var zeroVal *int - return zeroVal, errors.New("directive range is not implemented") + if data, ok := tmp.(*int); ok { + arg1 = data + } else if tmp == nil { + arg1 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) } - return ec.directives.Range(ctx, rawArgs, directive0, min, nil) } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*int); ok { - return data, nil - } else if tmp == nil { - var zeroVal *int - return zeroVal, nil - } else { - var zeroVal *int - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *int`, tmp)) - } -} - -func (ec *executionContext) field_Subscription_directiveNullableArg_argsArg3( - ctx context.Context, - rawArgs map[string]interface{}, -) (*string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("arg3")) - directive0 := func(ctx context.Context) (interface{}, error) { - tmp, ok := rawArgs["arg3"] - if !ok { - var zeroVal *string - return zeroVal, nil + args["arg2"] = arg1 + var arg2 *string + if tmp, ok := rawArgs["arg3"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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") + } + return ec.directives.ToNull(ctx, rawArgs, directive0) } - return ec.unmarshalOString2ᚖstring(ctx, tmp) - } - directive1 := func(ctx context.Context) (interface{}, error) { - if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + tmp, err = directive1(ctx) + if err != nil { + return nil, graphql.ErrorOnPath(ctx, err) + } + if data, ok := tmp.(*string); ok { + arg2 = data + } else if tmp == nil { + arg2 = nil + } else { + return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } - return ec.directives.ToNull(ctx, rawArgs, directive0) - } - - tmp, err := directive1(ctx) - if err != nil { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, err) - } - if data, ok := tmp.(*string); ok { - return data, nil - } else if tmp == nil { - var zeroVal *string - return zeroVal, nil - } else { - var zeroVal *string - return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be *string`, tmp)) } + args["arg3"] = arg2 + return args, nil } func (ec *executionContext) field_User_pets_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_User_pets_argsLimit(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["limit"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["limit"] = arg0 return args, nil } -func (ec *executionContext) field_User_pets_argsLimit( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["limit"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) - if tmp, ok := rawArgs["limit"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_ValidType_validArgs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_ValidType_validArgs_argsBreak(ctx, rawArgs) - if err != nil { - return nil, err - } - args["break"] = arg0 - arg1, err := ec.field_ValidType_validArgs_argsDefault(ctx, rawArgs) - if err != nil { - return nil, err - } - args["default"] = arg1 - arg2, err := ec.field_ValidType_validArgs_argsFunc(ctx, rawArgs) - if err != nil { - return nil, err - } - args["func"] = arg2 - arg3, err := ec.field_ValidType_validArgs_argsInterface(ctx, rawArgs) - if err != nil { - return nil, err - } - args["interface"] = arg3 - arg4, err := ec.field_ValidType_validArgs_argsSelect(ctx, rawArgs) - if err != nil { - return nil, err - } - args["select"] = arg4 - arg5, err := ec.field_ValidType_validArgs_argsCase(ctx, rawArgs) - if err != nil { - return nil, err - } - args["case"] = arg5 - arg6, err := ec.field_ValidType_validArgs_argsDefer(ctx, rawArgs) - if err != nil { - return nil, err - } - args["defer"] = arg6 - arg7, err := ec.field_ValidType_validArgs_argsGo(ctx, rawArgs) - if err != nil { - return nil, err - } - args["go"] = arg7 - arg8, err := ec.field_ValidType_validArgs_argsMap(ctx, rawArgs) - if err != nil { - return nil, err - } - args["map"] = arg8 - arg9, err := ec.field_ValidType_validArgs_argsStruct(ctx, rawArgs) - if err != nil { - return nil, err - } - args["struct"] = arg9 - arg10, err := ec.field_ValidType_validArgs_argsChan(ctx, rawArgs) - if err != nil { - return nil, err - } - args["chan"] = arg10 - arg11, err := ec.field_ValidType_validArgs_argsElse(ctx, rawArgs) - if err != nil { - return nil, err - } - args["else"] = arg11 - arg12, err := ec.field_ValidType_validArgs_argsGoto(ctx, rawArgs) - if err != nil { - return nil, err - } - args["goto"] = arg12 - arg13, err := ec.field_ValidType_validArgs_argsPackage(ctx, rawArgs) - if err != nil { - return nil, err - } - args["package"] = arg13 - arg14, err := ec.field_ValidType_validArgs_argsSwitch(ctx, rawArgs) - if err != nil { - return nil, err - } - args["switch"] = arg14 - arg15, err := ec.field_ValidType_validArgs_argsConst(ctx, rawArgs) - if err != nil { - return nil, err - } - args["const"] = arg15 - arg16, err := ec.field_ValidType_validArgs_argsFallthrough(ctx, rawArgs) - if err != nil { - return nil, err - } - args["fallthrough"] = arg16 - arg17, err := ec.field_ValidType_validArgs_argsIf(ctx, rawArgs) - if err != nil { - return nil, err - } - args["if"] = arg17 - arg18, err := ec.field_ValidType_validArgs_argsRange(ctx, rawArgs) - if err != nil { - return nil, err - } - args["range"] = arg18 - arg19, err := ec.field_ValidType_validArgs_argsType(ctx, rawArgs) - if err != nil { - return nil, err - } - args["type"] = arg19 - arg20, err := ec.field_ValidType_validArgs_argsContinue(ctx, rawArgs) - if err != nil { - return nil, err - } - args["continue"] = arg20 - arg21, err := ec.field_ValidType_validArgs_argsFor(ctx, rawArgs) - if err != nil { - return nil, err - } - args["for"] = arg21 - arg22, err := ec.field_ValidType_validArgs_argsImport(ctx, rawArgs) - if err != nil { - return nil, err - } - args["import"] = arg22 - arg23, err := ec.field_ValidType_validArgs_argsReturn(ctx, rawArgs) - if err != nil { - return nil, err - } - args["return"] = arg23 - arg24, err := ec.field_ValidType_validArgs_argsVar(ctx, rawArgs) - if err != nil { - return nil, err - } - args["var"] = arg24 - arg25, err := ec.field_ValidType_validArgs_args_(ctx, rawArgs) - if err != nil { - return nil, err - } - args["_"] = arg25 - return args, nil -} -func (ec *executionContext) field_ValidType_validArgs_argsBreak( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["break"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("break")) + var arg0 string if tmp, ok := rawArgs["break"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsDefault( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["default"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("break")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("default")) + args["break"] = arg0 + var arg1 string if tmp, ok := rawArgs["default"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsFunc( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["func"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("default")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("func")) + args["default"] = arg1 + var arg2 string if tmp, ok := rawArgs["func"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsInterface( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["interface"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("func")) + arg2, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("interface")) + args["func"] = arg2 + var arg3 string if tmp, ok := rawArgs["interface"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsSelect( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["select"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("interface")) + arg3, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("select")) + args["interface"] = arg3 + var arg4 string if tmp, ok := rawArgs["select"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsCase( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["case"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("select")) + arg4, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("case")) + args["select"] = arg4 + var arg5 string if tmp, ok := rawArgs["case"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsDefer( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["defer"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("case")) + arg5, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("defer")) + args["case"] = arg5 + var arg6 string if tmp, ok := rawArgs["defer"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsGo( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["go"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("defer")) + arg6, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("go")) + args["defer"] = arg6 + var arg7 string if tmp, ok := rawArgs["go"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsMap( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["map"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("go")) + arg7, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("map")) + args["go"] = arg7 + var arg8 string if tmp, ok := rawArgs["map"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsStruct( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["struct"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("map")) + arg8, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("struct")) + args["map"] = arg8 + var arg9 string if tmp, ok := rawArgs["struct"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsChan( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["chan"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("struct")) + arg9, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("chan")) + args["struct"] = arg9 + var arg10 string if tmp, ok := rawArgs["chan"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsElse( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["else"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("chan")) + arg10, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("else")) + args["chan"] = arg10 + var arg11 string if tmp, ok := rawArgs["else"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsGoto( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["goto"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("else")) + arg11, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("goto")) + args["else"] = arg11 + var arg12 string if tmp, ok := rawArgs["goto"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsPackage( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["package"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("goto")) + arg12, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) + args["goto"] = arg12 + var arg13 string if tmp, ok := rawArgs["package"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsSwitch( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["switch"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) + arg13, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("switch")) + args["package"] = arg13 + var arg14 string if tmp, ok := rawArgs["switch"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsConst( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["const"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("switch")) + arg14, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("const")) + args["switch"] = arg14 + var arg15 string if tmp, ok := rawArgs["const"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsFallthrough( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["fallthrough"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("const")) + arg15, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough")) + args["const"] = arg15 + var arg16 string if tmp, ok := rawArgs["fallthrough"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsIf( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["if"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough")) + arg16, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + args["fallthrough"] = arg16 + var arg17 string if tmp, ok := rawArgs["if"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsRange( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["range"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) + arg17, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("range")) + args["if"] = arg17 + var arg18 string if tmp, ok := rawArgs["range"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsType( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["type"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("range")) + arg18, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + args["range"] = arg18 + var arg19 string if tmp, ok := rawArgs["type"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsContinue( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["continue"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + arg19, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("continue")) + args["type"] = arg19 + var arg20 string if tmp, ok := rawArgs["continue"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsFor( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["for"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("continue")) + arg20, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("for")) + args["continue"] = arg20 + var arg21 string if tmp, ok := rawArgs["for"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsImport( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["import"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("for")) + arg21, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) + args["for"] = arg21 + var arg22 string if tmp, ok := rawArgs["import"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsReturn( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["return"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) + arg22, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("return")) + args["import"] = arg22 + var arg23 string if tmp, ok := rawArgs["return"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_argsVar( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["var"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("return")) + arg23, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("var")) + args["return"] = arg23 + var arg24 string if tmp, ok := rawArgs["var"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_ValidType_validArgs_args_( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["_"] - if !ok { - var zeroVal string - return zeroVal, nil + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("var")) + arg24, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("_")) + args["var"] = arg24 + var arg25 string if tmp, ok := rawArgs["_"]; ok { - return ec.unmarshalNString2string(ctx, tmp) + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("_")) + arg25, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } - - var zeroVal string - return zeroVal, nil + args["_"] = arg25 + return args, nil } func (ec *executionContext) field_ValidType_validInputKeywords_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_ValidType_validInputKeywords_argsInput(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *ValidInput + if tmp, ok := rawArgs["input"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + arg0, err = ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐValidInput(ctx, tmp) + if err != nil { + return nil, err + } } args["input"] = arg0 return args, nil } -func (ec *executionContext) field_ValidType_validInputKeywords_argsInput( - ctx context.Context, - rawArgs map[string]interface{}, -) (*ValidInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["input"] - if !ok { - var zeroVal *ValidInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) - if tmp, ok := rawArgs["input"]; ok { - return ec.unmarshalOValidInput2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐValidInput(ctx, tmp) - } - - var zeroVal *ValidInput - return zeroVal, nil -} func (ec *executionContext) field_VariadicModel_value_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_VariadicModel_value_argsRank(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["rank"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("rank")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["rank"] = arg0 return args, nil } -func (ec *executionContext) field_VariadicModel_value_argsRank( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["rank"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("rank")) - if tmp, ok := rawArgs["rank"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_WrappedMap_get_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_WrappedMap_get_argsKey(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["key"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["key"] = arg0 return args, nil } -func (ec *executionContext) field_WrappedMap_get_argsKey( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["key"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key")) - if tmp, ok := rawArgs["key"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_WrappedSlice_get_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_WrappedSlice_get_argsIdx(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["idx"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("idx")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["idx"] = arg0 return args, nil } -func (ec *executionContext) field_WrappedSlice_get_argsIdx( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["idx"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("idx")) - if tmp, ok := rawArgs["idx"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -8293,26 +6838,21 @@ func (ec *executionContext) _ObjectDirectives_text(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return obj.Text, nil } - directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, max, message) } @@ -8371,11 +6911,9 @@ func (ec *executionContext) _ObjectDirectives_nullableText(ctx context.Context, ctx = rctx // use context from middleware stack in children return obj.NullableText, nil } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + return nil, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -8472,11 +7010,9 @@ func (ec *executionContext) _ObjectDirectivesWithCustomGoModel_nullableText(ctx ctx = rctx // use context from middleware stack in children return obj.NullableText, nil } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { - var zeroVal string - return zeroVal, errors.New("directive toNull is not implemented") + return nil, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -10718,52 +9254,43 @@ func (ec *executionContext) _Query_directiveObject(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveObject(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "order1_1") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order1 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order1 is not implemented") + return nil, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive0, location) } directive2 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "order1_2") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order1 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order1 is not implemented") + return nil, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive1, location) } directive3 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "order2_1") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order2 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order2 is not implemented") + return nil, errors.New("directive order2 is not implemented") } return ec.directives.Order2(ctx, nil, directive2, location) } directive4 := func(ctx context.Context) (interface{}, error) { location, err := ec.unmarshalNString2string(ctx, "Query_field") if err != nil { - var zeroVal *ObjectDirectives - return zeroVal, err + return nil, err } if ec.directives.Order1 == nil { - var zeroVal *ObjectDirectives - return zeroVal, errors.New("directive order1 is not implemented") + return nil, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive3, location) } @@ -10869,21 +9396,17 @@ func (ec *executionContext) _Query_directiveFieldDef(ctx context.Context, field ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveFieldDef(rctx, fc.Args["ret"].(string)) } - directive1 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, nil, directive0, min, nil, message) } @@ -10991,18 +9514,15 @@ func (ec *executionContext) _Query_directiveDouble(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveDouble(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive1 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive1 is not implemented") + return nil, errors.New("directive directive1 is not implemented") } return ec.directives.Directive1(ctx, nil, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive2 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive2 is not implemented") + return nil, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -11058,11 +9578,9 @@ func (ec *executionContext) _Query_directiveUnimplemented(ctx context.Context, f ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveUnimplemented(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Unimplemented == nil { - var zeroVal *string - return zeroVal, errors.New("directive unimplemented is not implemented") + return nil, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -11334,11 +9852,9 @@ func (ec *executionContext) _Query_noShape(ctx context.Context, field graphql.Co ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NoShape(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.MakeNil == nil { - var zeroVal Shape - return zeroVal, errors.New("directive makeNil is not implemented") + return nil, errors.New("directive makeNil is not implemented") } return ec.directives.MakeNil(ctx, nil, directive0) } @@ -11435,11 +9951,9 @@ func (ec *executionContext) _Query_noShapeTypedNil(ctx context.Context, field gr ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().NoShapeTypedNil(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.MakeTypedNil == nil { - var zeroVal Shape - return zeroVal, errors.New("directive makeTypedNil is not implemented") + return nil, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -11495,11 +10009,9 @@ func (ec *executionContext) _Query_animal(ctx context.Context, field graphql.Col ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().Animal(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.MakeTypedNil == nil { - var zeroVal Animal - return zeroVal, errors.New("directive makeTypedNil is not implemented") + return nil, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -13780,18 +12292,15 @@ func (ec *executionContext) _Subscription_directiveDouble(ctx context.Context, f ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveDouble(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive1 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive1 is not implemented") + return nil, errors.New("directive directive1 is not implemented") } return ec.directives.Directive1(ctx, nil, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive2 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive2 is not implemented") + return nil, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -13861,11 +12370,9 @@ func (ec *executionContext) _Subscription_directiveUnimplemented(ctx context.Con ctx = rctx // use context from middleware stack in children return ec.resolvers.Subscription().DirectiveUnimplemented(rctx) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Unimplemented == nil { - var zeroVal *string - return zeroVal, errors.New("directive unimplemented is not implemented") + return nil, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -16729,21 +15236,17 @@ func (ec *executionContext) unmarshalInputInnerDirectives(ctx context.Context, o case "message": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("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 { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, nil, message) } @@ -16808,33 +15311,27 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "text": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("text")) directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNString2string(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal string - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - var zeroVal string - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal string - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, message) } @@ -16852,18 +15349,15 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o case "nullableText": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("nullableText")) directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOString2ᚖstring(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *string - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { if ec.directives.ToNull == nil { - var zeroVal *string - return zeroVal, errors.New("directive toNull is not implemented") + return nil, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive1) } @@ -16885,11 +15379,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalNInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInnerDirectives(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *InnerDirectives - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -16911,11 +15403,9 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOInnerDirectives2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInnerDirectives(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *InnerDirectives - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -16937,28 +15427,23 @@ func (ec *executionContext) unmarshalInputInputDirectives(ctx context.Context, o directive0 := func(ctx context.Context) (interface{}, error) { return ec.unmarshalOThirdParty2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐThirdParty(ctx, v) } - directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Directive3 == nil { - var zeroVal *ThirdParty - return zeroVal, errors.New("directive directive3 is not implemented") + return nil, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } directive2 := func(ctx context.Context) (interface{}, error) { min, err := ec.unmarshalNInt2int(ctx, 0) if err != nil { - var zeroVal *ThirdParty - return zeroVal, err + return nil, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - var zeroVal *ThirdParty - return zeroVal, err + return nil, err } if ec.directives.Length == nil { - var zeroVal *ThirdParty - return zeroVal, errors.New("directive length is not implemented") + return nil, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, nil) } diff --git a/docs/content/config.md b/docs/content/config.md index 6972cebec44..2a73b0c829c 100644 --- a/docs/content/config.md +++ b/docs/content/config.md @@ -81,16 +81,6 @@ resolver: # Optional: wrap nullable input fields with Omittable # nullable_input_omittable: true -# Optional: wrap nullable input fields with Omittable -# nullable_input_omittable: true - -# Optional: if this is set to true, argument directives that -# decorate a field with a null value will still be called. -# -# This enables argumment directives to not just mutate -# argument values but to set them even if they're null. -# call_argument_directives_with_null: false - # Optional: set to speed up generation time by not performing a final validation pass. # skip_validation: true diff --git a/integration/server/generated.go b/integration/server/generated.go index c8a4e4c756a..0c54c61b677 100644 --- a/integration/server/generated.go +++ b/integration/server/generated.go @@ -368,258 +368,122 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) dir_magic_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_magic_argsKind(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *int + if tmp, ok := rawArgs["kind"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) + arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) + if err != nil { + return nil, err + } } args["kind"] = arg0 return args, nil } -func (ec *executionContext) dir_magic_argsKind( - ctx context.Context, - rawArgs map[string]interface{}, -) (*int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["kind"] - if !ok { - var zeroVal *int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("kind")) - if tmp, ok := rawArgs["kind"]; ok { - return ec.unmarshalOInt2ᚖint(ctx, tmp) - } - - var zeroVal *int - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query_coercion_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_coercion_argsValue(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*models.ListCoercion + if tmp, ok := rawArgs["value"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) + arg0, err = ec.unmarshalOListCoercion2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋserverᚋmodelsᚑgoᚐListCoercionᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["value"] = arg0 return args, nil } -func (ec *executionContext) field_Query_coercion_argsValue( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*models.ListCoercion, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["value"] - if !ok { - var zeroVal []*models.ListCoercion - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) - if tmp, ok := rawArgs["value"]; ok { - return ec.unmarshalOListCoercion2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋserverᚋmodelsᚑgoᚐListCoercionᚄ(ctx, tmp) - } - - var zeroVal []*models.ListCoercion - return zeroVal, nil -} func (ec *executionContext) field_Query_complexity_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_complexity_argsValue(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["value"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["value"] = arg0 return args, nil } -func (ec *executionContext) field_Query_complexity_argsValue( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["value"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("value")) - if tmp, ok := rawArgs["value"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_Query_date_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_date_argsFilter(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 models.DateFilter + if tmp, ok := rawArgs["filter"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) + arg0, err = ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋserverᚋmodelsᚑgoᚐDateFilter(ctx, tmp) + if err != nil { + return nil, err + } } args["filter"] = arg0 return args, nil } -func (ec *executionContext) field_Query_date_argsFilter( - ctx context.Context, - rawArgs map[string]interface{}, -) (models.DateFilter, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["filter"] - if !ok { - var zeroVal models.DateFilter - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("filter")) - if tmp, ok := rawArgs["filter"]; ok { - return ec.unmarshalNDateFilter2githubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋserverᚋmodelsᚑgoᚐDateFilter(ctx, tmp) - } - - var zeroVal models.DateFilter - return zeroVal, nil -} func (ec *executionContext) field_Query_error_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query_error_argsType(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *models.ErrorType + if tmp, ok := rawArgs["type"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) + arg0, err = ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋserverᚋmodelsᚑgoᚐErrorType(ctx, tmp) + if err != nil { + return nil, err + } } args["type"] = arg0 return args, nil } -func (ec *executionContext) field_Query_error_argsType( - ctx context.Context, - rawArgs map[string]interface{}, -) (*models.ErrorType, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["type"] - if !ok { - var zeroVal *models.ErrorType - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - if tmp, ok := rawArgs["type"]; ok { - return ec.unmarshalOErrorType2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋintegrationᚋserverᚋmodelsᚑgoᚐErrorType(ctx, tmp) - } - - var zeroVal *models.ErrorType - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** diff --git a/plugin/federation/testdata/entityresolver/generated/exec.go b/plugin/federation/testdata/entityresolver/generated/exec.go index 5961babaf0a..8b13a61bb7f 100644 --- a/plugin/federation/testdata/entityresolver/generated/exec.go +++ b/plugin/federation/testdata/entityresolver/generated/exec.go @@ -872,723 +872,329 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) dir_entityResolver_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_entityResolver_argsMulti(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["multi"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("multi")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["multi"] = arg0 return args, nil } -func (ec *executionContext) dir_entityResolver_argsMulti( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["multi"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("multi")) - if tmp, ok := rawArgs["multi"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} func (ec *executionContext) field_Entity_findHelloByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findHelloByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findHelloByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findHelloMultiSingleKeysByKey1AndKey2_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["key1"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key1")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["key1"] = arg0 - arg1, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["key2"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key2")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["key2"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["key1"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key1")) - if tmp, ok := rawArgs["key1"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["key2"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key2")) - if tmp, ok := rawArgs["key2"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findHelloWithErrorsByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findHelloWithErrorsByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findHelloWithErrorsByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*model.MultiHelloByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*model.MultiHelloByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*model.MultiHelloByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloByNamesInput(ctx, tmp) - } - - var zeroVal []*model.MultiHelloByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloMultipleRequiresByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*model.MultiHelloMultipleRequiresByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloMultipleRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloMultipleRequiresByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*model.MultiHelloMultipleRequiresByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*model.MultiHelloMultipleRequiresByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloMultipleRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloMultipleRequiresByNamesInput(ctx, tmp) - } - - var zeroVal []*model.MultiHelloMultipleRequiresByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloRequiresByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloRequiresByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*model.MultiHelloRequiresByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloRequiresByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloRequiresByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*model.MultiHelloRequiresByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*model.MultiHelloRequiresByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloRequiresByNamesInput(ctx, tmp) - } - - var zeroVal []*model.MultiHelloRequiresByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloWithErrorByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloWithErrorByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*model.MultiHelloWithErrorByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloWithErrorByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloWithErrorByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloWithErrorByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*model.MultiHelloWithErrorByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*model.MultiHelloWithErrorByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloWithErrorByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiHelloWithErrorByNamesInput(ctx, tmp) - } - - var zeroVal []*model.MultiHelloWithErrorByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiPlanetRequiresNestedByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*model.MultiPlanetRequiresNestedByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiPlanetRequiresNestedByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiPlanetRequiresNestedByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*model.MultiPlanetRequiresNestedByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*model.MultiPlanetRequiresNestedByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiPlanetRequiresNestedByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋentityresolverᚋgeneratedᚋmodelᚐMultiPlanetRequiresNestedByNamesInput(ctx, tmp) - } - - var zeroVal []*model.MultiPlanetRequiresNestedByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findPlanetMultipleRequiresByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findPlanetMultipleRequiresByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findPlanetMultipleRequiresByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findPlanetRequiresByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findPlanetRequiresByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findPlanetRequiresByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findPlanetRequiresNestedByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findPlanetRequiresNestedByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findPlanetRequiresNestedByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldByHelloNameAndFoo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsHelloName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["helloName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["helloName"] = arg0 - arg1, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsFoo(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["foo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["foo"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findWorldByHelloNameAndFoo_argsHelloName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["helloName"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) - if tmp, ok := rawArgs["helloName"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findWorldByHelloNameAndFoo_argsFoo( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["foo"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) - if tmp, ok := rawArgs["foo"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldNameByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldNameByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findWorldNameByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByBar_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldWithMultipleKeysByBar_argsBar(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["bar"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("bar")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["bar"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByBar_argsBar( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["bar"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("bar")) - if tmp, ok := rawArgs["bar"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["helloName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["helloName"] = arg0 - arg1, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["foo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["foo"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["helloName"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) - if tmp, ok := rawArgs["helloName"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["foo"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) - if tmp, ok := rawArgs["foo"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []map[string]interface{} + if tmp, ok := rawArgs["representations"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["representations"] = arg0 return args, nil } -func (ec *executionContext) field_Query__entities_argsRepresentations( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["representations"] - if !ok { - var zeroVal []map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) - if tmp, ok := rawArgs["representations"]; ok { - return ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) - } - - var zeroVal []map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -1796,16 +1402,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloByNames(ctx context.Contex ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloByNames(rctx, fc.Args["reps"].([]*model.MultiHelloByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*model.MultiHello - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*model.MultiHello - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1879,16 +1482,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloMultipleRequiresByNames(ct ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloMultipleRequiresByNames(rctx, fc.Args["reps"].([]*model.MultiHelloMultipleRequiresByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*model.MultiHelloMultipleRequires - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*model.MultiHelloMultipleRequires - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1968,16 +1568,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloRequiresByNames(ctx contex ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloRequiresByNames(rctx, fc.Args["reps"].([]*model.MultiHelloRequiresByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*model.MultiHelloRequires - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*model.MultiHelloRequires - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -2055,16 +1652,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloWithErrorByNames(ctx conte ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloWithErrorByNames(rctx, fc.Args["reps"].([]*model.MultiHelloWithErrorByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*model.MultiHelloWithError - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*model.MultiHelloWithError - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -2138,16 +1732,13 @@ func (ec *executionContext) _Entity_findManyMultiPlanetRequiresNestedByNames(ctx ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiPlanetRequiresNestedByNames(rctx, fc.Args["reps"].([]*model.MultiPlanetRequiresNestedByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*model.MultiPlanetRequiresNested - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*model.MultiPlanetRequiresNested - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } diff --git a/plugin/federation/testdata/explicitrequires/generated/exec.go b/plugin/federation/testdata/explicitrequires/generated/exec.go index 77ac14b8f01..7f30d6ca5e3 100644 --- a/plugin/federation/testdata/explicitrequires/generated/exec.go +++ b/plugin/federation/testdata/explicitrequires/generated/exec.go @@ -325,723 +325,329 @@ var parsedSchema = gqlparser.MustLoadSchema(sources...) func (ec *executionContext) dir_entityResolver_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.dir_entityResolver_argsMulti(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 *bool + if tmp, ok := rawArgs["multi"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("multi")) + arg0, err = ec.unmarshalOBoolean2ᚖbool(ctx, tmp) + if err != nil { + return nil, err + } } args["multi"] = arg0 return args, nil } -func (ec *executionContext) dir_entityResolver_argsMulti( - ctx context.Context, - rawArgs map[string]interface{}, -) (*bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["multi"] - if !ok { - var zeroVal *bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("multi")) - if tmp, ok := rawArgs["multi"]; ok { - return ec.unmarshalOBoolean2ᚖbool(ctx, tmp) - } - - var zeroVal *bool - return zeroVal, nil -} func (ec *executionContext) field_Entity_findHelloByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findHelloByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findHelloByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findHelloMultiSingleKeysByKey1AndKey2_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["key1"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key1")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["key1"] = arg0 - arg1, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["key2"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("key2")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["key2"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["key1"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key1")) - if tmp, ok := rawArgs["key1"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["key2"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("key2")) - if tmp, ok := rawArgs["key2"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findHelloWithErrorsByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findHelloWithErrorsByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findHelloWithErrorsByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*MultiHelloByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*MultiHelloByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*MultiHelloByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloByNamesInput(ctx, tmp) - } - - var zeroVal []*MultiHelloByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloMultipleRequiresByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*MultiHelloMultipleRequiresByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloMultipleRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloMultipleRequiresByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*MultiHelloMultipleRequiresByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*MultiHelloMultipleRequiresByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloMultipleRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloMultipleRequiresByNamesInput(ctx, tmp) - } - - var zeroVal []*MultiHelloMultipleRequiresByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloRequiresByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloRequiresByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*MultiHelloRequiresByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloRequiresByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloRequiresByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*MultiHelloRequiresByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*MultiHelloRequiresByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloRequiresByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloRequiresByNamesInput(ctx, tmp) - } - - var zeroVal []*MultiHelloRequiresByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiHelloWithErrorByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiHelloWithErrorByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*MultiHelloWithErrorByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiHelloWithErrorByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloWithErrorByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiHelloWithErrorByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*MultiHelloWithErrorByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*MultiHelloWithErrorByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiHelloWithErrorByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiHelloWithErrorByNamesInput(ctx, tmp) - } - - var zeroVal []*MultiHelloWithErrorByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findManyMultiPlanetRequiresNestedByNames_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []*MultiPlanetRequiresNestedByNamesInput + if tmp, ok := rawArgs["reps"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) + arg0, err = ec.unmarshalNMultiPlanetRequiresNestedByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiPlanetRequiresNestedByNamesInput(ctx, tmp) + if err != nil { + return nil, err + } } args["reps"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]*MultiPlanetRequiresNestedByNamesInput, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["reps"] - if !ok { - var zeroVal []*MultiPlanetRequiresNestedByNamesInput - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("reps")) - if tmp, ok := rawArgs["reps"]; ok { - return ec.unmarshalNMultiPlanetRequiresNestedByNamesInput2ᚕᚖgithubᚗcomᚋ99designsᚋgqlgenᚋpluginᚋfederationᚋtestdataᚋexplicitrequiresᚋgeneratedᚐMultiPlanetRequiresNestedByNamesInput(ctx, tmp) - } - - var zeroVal []*MultiPlanetRequiresNestedByNamesInput - return zeroVal, nil -} func (ec *executionContext) field_Entity_findPlanetMultipleRequiresByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findPlanetMultipleRequiresByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findPlanetMultipleRequiresByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findPlanetRequiresByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findPlanetRequiresByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findPlanetRequiresByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findPlanetRequiresNestedByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findPlanetRequiresNestedByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findPlanetRequiresNestedByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldByHelloNameAndFoo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsHelloName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["helloName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["helloName"] = arg0 - arg1, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsFoo(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["foo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["foo"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findWorldByHelloNameAndFoo_argsHelloName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["helloName"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) - if tmp, ok := rawArgs["helloName"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findWorldByHelloNameAndFoo_argsFoo( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["foo"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) - if tmp, ok := rawArgs["foo"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldNameByName_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldNameByName_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findWorldNameByName_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByBar_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldWithMultipleKeysByBar_argsBar(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 int + if tmp, ok := rawArgs["bar"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("bar")) + arg0, err = ec.unmarshalNInt2int(ctx, tmp) + if err != nil { + return nil, err + } } args["bar"] = arg0 return args, nil } -func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByBar_argsBar( - ctx context.Context, - rawArgs map[string]interface{}, -) (int, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["bar"] - if !ok { - var zeroVal int - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("bar")) - if tmp, ok := rawArgs["bar"]; ok { - return ec.unmarshalNInt2int(ctx, tmp) - } - - var zeroVal int - return zeroVal, nil -} func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["helloName"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["helloName"] = arg0 - arg1, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo(ctx, rawArgs) - if err != nil { - return nil, err + var arg1 string + if tmp, ok := rawArgs["foo"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) + arg1, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["foo"] = arg1 return args, nil } -func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["helloName"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("helloName")) - if tmp, ok := rawArgs["helloName"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} - -func (ec *executionContext) field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["foo"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("foo")) - if tmp, ok := rawArgs["foo"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query___type_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query___type_argsName(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 string + if tmp, ok := rawArgs["name"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + arg0, err = ec.unmarshalNString2string(ctx, tmp) + if err != nil { + return nil, err + } } args["name"] = arg0 return args, nil } -func (ec *executionContext) field_Query___type_argsName( - ctx context.Context, - rawArgs map[string]interface{}, -) (string, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["name"] - if !ok { - var zeroVal string - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) - if tmp, ok := rawArgs["name"]; ok { - return ec.unmarshalNString2string(ctx, tmp) - } - - var zeroVal string - return zeroVal, nil -} func (ec *executionContext) field_Query__entities_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 []map[string]interface{} + if tmp, ok := rawArgs["representations"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) + arg0, err = ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) + if err != nil { + return nil, err + } } args["representations"] = arg0 return args, nil } -func (ec *executionContext) field_Query__entities_argsRepresentations( - ctx context.Context, - rawArgs map[string]interface{}, -) ([]map[string]interface{}, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["representations"] - if !ok { - var zeroVal []map[string]interface{} - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("representations")) - if tmp, ok := rawArgs["representations"]; ok { - return ec.unmarshalN_Any2ᚕmapᚄ(ctx, tmp) - } - - var zeroVal []map[string]interface{} - return zeroVal, nil -} func (ec *executionContext) field___Type_enumValues_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_enumValues_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_enumValues_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} func (ec *executionContext) field___Type_fields_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - arg0, err := ec.field___Type_fields_argsIncludeDeprecated(ctx, rawArgs) - if err != nil { - return nil, err + var arg0 bool + if tmp, ok := rawArgs["includeDeprecated"]; ok { + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) + arg0, err = ec.unmarshalOBoolean2bool(ctx, tmp) + if err != nil { + return nil, err + } } args["includeDeprecated"] = arg0 return args, nil } -func (ec *executionContext) field___Type_fields_argsIncludeDeprecated( - ctx context.Context, - rawArgs map[string]interface{}, -) (bool, error) { - // We won't call the directive if the argument is null. - // Set call_argument_directives_with_null to true to call directives - // even if the argument is null. - _, ok := rawArgs["includeDeprecated"] - if !ok { - var zeroVal bool - return zeroVal, nil - } - - ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("includeDeprecated")) - if tmp, ok := rawArgs["includeDeprecated"]; ok { - return ec.unmarshalOBoolean2bool(ctx, tmp) - } - - var zeroVal bool - return zeroVal, nil -} // endregion ***************************** args.gotpl ***************************** @@ -1249,16 +855,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloByNames(ctx context.Contex ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloByNames(rctx, fc.Args["reps"].([]*MultiHelloByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*MultiHello - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*MultiHello - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1332,16 +935,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloMultipleRequiresByNames(ct ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloMultipleRequiresByNames(rctx, fc.Args["reps"].([]*MultiHelloMultipleRequiresByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*MultiHelloMultipleRequires - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*MultiHelloMultipleRequires - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1421,16 +1021,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloRequiresByNames(ctx contex ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloRequiresByNames(rctx, fc.Args["reps"].([]*MultiHelloRequiresByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*MultiHelloRequires - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*MultiHelloRequires - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1508,16 +1105,13 @@ func (ec *executionContext) _Entity_findManyMultiHelloWithErrorByNames(ctx conte ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiHelloWithErrorByNames(rctx, fc.Args["reps"].([]*MultiHelloWithErrorByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*MultiHelloWithError - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*MultiHelloWithError - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1591,16 +1185,13 @@ func (ec *executionContext) _Entity_findManyMultiPlanetRequiresNestedByNames(ctx ctx = rctx // use context from middleware stack in children return ec.resolvers.Entity().FindManyMultiPlanetRequiresNestedByNames(rctx, fc.Args["reps"].([]*MultiPlanetRequiresNestedByNamesInput)) } - directive1 := func(ctx context.Context) (interface{}, error) { multi, err := ec.unmarshalOBoolean2ᚖbool(ctx, true) if err != nil { - var zeroVal []*MultiPlanetRequiresNested - return zeroVal, err + return nil, err } if ec.directives.EntityResolver == nil { - var zeroVal []*MultiPlanetRequiresNested - return zeroVal, errors.New("directive entityResolver is not implemented") + return nil, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) }