diff --git a/_examples/chat/generated.go b/_examples/chat/generated.go index 8aee5f92e44..3b6e1e3b1da 100644 --- a/_examples/chat/generated.go +++ b/_examples/chat/generated.go @@ -343,125 +343,280 @@ 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{}{} - 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 - } + arg0, err := ec.dir_user_argsUsername(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_post_argsText(ctx, rawArgs) + if err != nil { + return nil, err } args["text"] = arg0 - 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 - } + arg1, err := ec.field_Mutation_post_argsUsername(ctx, rawArgs) + if err != nil { + return nil, err } args["username"] = arg1 - 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 - } + arg2, err := ec.field_Mutation_post_argsRoomName(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_room_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Subscription_messageAdded_argsRoomName(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 a6a88a7f9fd..25dc1589a61 100644 --- a/_examples/config/generated.go +++ b/_examples/config/generated.go @@ -335,62 +335,130 @@ 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{}{} - 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 - } + arg0, err := ec.field_Mutation_createTodo_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 5bf77cce89d..c2fc36b7816 100644 --- a/_examples/dataloader/generated.go +++ b/_examples/dataloader/generated.go @@ -337,77 +337,162 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_torture1d_argsCustomerIds(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_torture2d_argsCustomerIds(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 d58c2e12387..a13b9e6d1a1 100644 --- a/_examples/embedding/subdir/gendir/generated.go +++ b/_examples/embedding/subdir/gendir/generated.go @@ -246,47 +246,98 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 9e8c3daac8f..9f1c6cc9d1e 100644 --- a/_examples/embedding/subdir/prelude.generated.go +++ b/_examples/embedding/subdir/prelude.generated.go @@ -24,56 +24,125 @@ 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{}{} - 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 - } + arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) + if err != nil { + return nil, err } args["if"] = arg0 - 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 - } + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 e7f0006d3f0..b7c57d28019 100644 --- a/_examples/embedding/subdir/root.generated.go +++ b/_examples/embedding/subdir/root.generated.go @@ -30,17 +30,34 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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 8c959c08822..697c6188ec9 100644 --- a/_examples/enum/api/exec.go +++ b/_examples/enum/api/exec.go @@ -456,272 +456,578 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_boolTypedN_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_boolTyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_boolUntypedN_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_boolUntyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_inPackage_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_intTypedN_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_intTyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_intUntypedN_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_intUntyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_stringTypedN_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_stringTyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_stringUntypedN_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_stringUntyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_varTyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_varUntyped_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 bb9d4cc4af5..e10c6ec0de9 100644 --- a/_examples/federation/accounts/graph/generated.go +++ b/_examples/federation/accounts/graph/generated.go @@ -345,92 +345,194 @@ 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{}{} - 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 - } + arg0, err := ec.field_Entity_findEmailHostByID_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findUserByID_argsID(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 b96a3f4cccb..86bf3fc6af7 100644 --- a/_examples/federation/products/graph/generated.go +++ b/_examples/federation/products/graph/generated.go @@ -369,131 +369,285 @@ 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManufacturerByID_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findProductByManufacturerIDAndID_argsManufacturerID(ctx, rawArgs) + if err != nil { + return nil, err } args["manufacturerID"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findProductByManufacturerIDAndID_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findProductByUpc_argsUpc(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_topProducts_argsFirst(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 a7992016140..9115e4176c5 100644 --- a/_examples/federation/reviews/graph/generated.go +++ b/_examples/federation/reviews/graph/generated.go @@ -399,101 +399,221 @@ 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{}{} - 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 - } + arg0, err := ec.field_Entity_findProductByManufacturerIDAndID_argsManufacturerID(ctx, rawArgs) + if err != nil { + return nil, err } args["manufacturerID"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findProductByManufacturerIDAndID_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findUserByID_argsID(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 bd2f3e7ccd2..59b14de0c41 100644 --- a/_examples/fileupload/generated.go +++ b/_examples/fileupload/generated.go @@ -306,107 +306,226 @@ 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{}{} - 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 - } + arg0, err := ec.field_Mutation_multipleUploadWithPayload_argsReq(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_multipleUpload_argsFiles(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_singleUploadWithPayload_argsReq(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_singleUpload_argsFile(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 dcebf636a55..c3986e86ecb 100644 --- a/_examples/scalars/generated.go +++ b/_examples/scalars/generated.go @@ -344,101 +344,221 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_search_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_userByTier_argsTier(ctx, rawArgs) + if err != nil { + return nil, err } args["tier"] = arg0 - 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 - } + arg1, err := ec.field_Query_userByTier_argsDarkMode(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_user_argsID(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 700f6dbc7dc..acc443f20ea 100644 --- a/_examples/selection/generated.go +++ b/_examples/selection/generated.go @@ -262,47 +262,98 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 d3bb5cff569..29e222b5c59 100644 --- a/_examples/starwars/generated/exec.go +++ b/_examples/starwars/generated/exec.go @@ -760,263 +760,590 @@ 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{}{} - 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 - } + arg0, err := ec.field_Droid_friendsConnection_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err } args["first"] = arg0 - 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 - } + arg1, err := ec.field_Droid_friendsConnection_argsAfter(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Human_friendsConnection_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err } args["first"] = arg0 - 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 - } + arg1, err := ec.field_Human_friendsConnection_argsAfter(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Human_height_argsUnit(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_createReview_argsEpisode(ctx, rawArgs) + if err != nil { + return nil, err } args["episode"] = arg0 - 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 - } + arg1, err := ec.field_Mutation_createReview_argsReview(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_character_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_droid_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_hero_argsEpisode(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_human_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_reviews_argsEpisode(ctx, rawArgs) + if err != nil { + return nil, err } args["episode"] = arg0 - 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 - } + arg1, err := ec.field_Query_reviews_argsSince(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_search_argsText(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_starship_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Starship_length_argsUnit(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 593251b2a03..90066bf6600 100644 --- a/_examples/todo/generated.go +++ b/_examples/todo/generated.go @@ -298,131 +298,285 @@ 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{}{} - 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 - } + arg0, err := ec.dir_hasRole_argsRole(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.dir_user_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_MyMutation_createTodo_argsTodo(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_MyMutation_updateTodo_argsID(ctx, rawArgs) + if err != nil { + return nil, err } args["id"] = arg0 - 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 - } + arg1, err := ec.field_MyMutation_updateTodo_argsChanges(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_MyQuery___type_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_MyQuery_todo_argsID(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 ***************************** @@ -1017,13 +1171,16 @@ 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 { - return nil, err + var zeroVal bool + return zeroVal, err } if ec.directives.HasRole == nil { - return nil, errors.New("directive hasRole is not implemented") + var zeroVal bool + return zeroVal, 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 cb8ceccf456..ae8b3ed7bcb 100644 --- a/_examples/type-system-extension/generated.go +++ b/_examples/type-system-extension/generated.go @@ -292,77 +292,162 @@ 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{}{} - 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 - } + arg0, err := ec.field_MyMutation_createTodo_argsTodo(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_MyQuery___type_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_MyQuery_todo_argsID(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 ***************************** @@ -389,9 +474,11 @@ 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 { - return nil, errors.New("directive objectLogging is not implemented") + var zeroVal *Todo + return zeroVal, errors.New("directive objectLogging is not implemented") } return ec.directives.ObjectLogging(ctx, nil, directive0) } @@ -474,9 +561,11 @@ 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 { - return nil, errors.New("directive objectLogging is not implemented") + var zeroVal []*Todo + return zeroVal, errors.New("directive objectLogging is not implemented") } return ec.directives.ObjectLogging(ctx, nil, directive0) } @@ -548,9 +637,11 @@ 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 { - return nil, errors.New("directive objectLogging is not implemented") + var zeroVal *Todo + return zeroVal, errors.New("directive objectLogging is not implemented") } return ec.directives.ObjectLogging(ctx, nil, directive0) } @@ -891,9 +982,11 @@ 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 { - return nil, errors.New("directive fieldLogging is not implemented") + var zeroVal bool + return zeroVal, errors.New("directive fieldLogging is not implemented") } return ec.directives.FieldLogging(ctx, obj, directive0) } @@ -2728,9 +2821,11 @@ 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 { - return nil, errors.New("directive inputLogging is not implemented") + var zeroVal string + return zeroVal, 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 983a3a02a71..e8c1bfeeb9c 100644 --- a/codegen/args.go +++ b/codegen/args.go @@ -18,12 +18,13 @@ 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 + 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 } // ImplDirectives get not Builtin and location ARGUMENT_DEFINITION directive @@ -57,11 +58,12 @@ 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, + ArgumentDefinition: arg, + TypeReference: tr, + Object: obj, + VarName: templates.ToGoPrivate(arg.Name), + Directives: argDirs, + CallArgumentDirectivesWithNull: b.Config.CallArgumentDirectivesWithNull, } if arg.DefaultValue != nil { diff --git a/codegen/args.gotpl b/codegen/args.gotpl index 7b541ae1f2e..2f3afdf077f 100644 --- a/codegen/args.gotpl +++ b/codegen/args.gotpl @@ -2,35 +2,67 @@ func (ec *executionContext) {{ $name }}(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} + {{- range $i, $arg := . }} - var arg{{$i}} {{ $arg.TypeReference.GO | ref}} - if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField({{$arg.Name|quote}})) + 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}})) {{- if $arg.ImplDirectives }} - directive0 := func(ctx context.Context) (interface{}, error) { return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } + 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) + } {{ template "implDirectives" $arg }} - tmp, err = directive{{$arg.ImplDirectives|len}}(ctx) + tmp, err := directive{{$arg.ImplDirectives|len}}(ctx) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal {{ $arg.TypeReference.GO | ref}} + return zeroVal, graphql.ErrorOnPath(ctx, err) } if data, ok := tmp.({{ $arg.TypeReference.GO | ref }}) ; ok { - arg{{$i}} = data + return data, nil {{- if $arg.TypeReference.IsNilable }} } else if tmp == nil { - arg{{$i}} = nil + var zeroVal {{ $arg.TypeReference.GO | ref}} + return zeroVal, nil {{- end }} } else { - return nil, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)) + var zeroVal {{ $arg.TypeReference.GO | ref}} + return zeroVal, graphql.ErrorOnPath(ctx, fmt.Errorf(`unexpected type %T from directive, should be {{ $arg.TypeReference.GO }}`, tmp)) } {{- else }} - arg{{$i}}, err = ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) - if err != nil { - return nil, err + if tmp, ok := rawArgs[{{$arg.Name|quote}}]; ok { + return ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, tmp) } + + var zeroVal {{ $arg.TypeReference.GO | ref}} + return zeroVal, nil {{- end }} } - args[{{$arg.Name|quote}}] = arg{{$i}} - {{- end }} - return args, nil -} + {{end}} {{ end }} diff --git a/codegen/config/config.go b/codegen/config/config.go index 54776083d6d..3e41695bc86 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -22,36 +22,42 @@ 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"` - 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"` + // 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:"-"` // 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 23bcf0f879b..18ad0237111 100644 --- a/codegen/directives.gotpl +++ b/codegen/directives.gotpl @@ -1,21 +1,25 @@ {{ 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{ - return nil, err + var zeroVal {{$zeroVal}} + return zeroVal, err } {{- else if notNil "Default" $arg }} {{ $arg.VarName }}, err := ec.{{ $arg.TypeReference.UnmarshalFunc }}(ctx, {{ $arg.Default | dump }}) if err != nil{ - return nil, err + var zeroVal {{$zeroVal}} + return zeroVal, err } {{- end }} {{- end }} if ec.directives.{{$directive.Name|ucFirst}} == nil { - return nil, errors.New("directive {{$directive.Name}} is not implemented") + var zeroVal {{$zeroVal}} + return zeroVal, 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 207f6742476..e2ee0132d8a 100644 --- a/codegen/testserver/followschema/defaults.generated.go +++ b/codegen/testserver/followschema/defaults.generated.go @@ -29,62 +29,130 @@ 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{}{} - 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 - } + arg0, err := ec.field_Mutation_defaultInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_overrideValueViaInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_updatePtrToPtr_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_updateSomething_argsInput(ctx, rawArgs) + 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 3c0e0d5cb33..30afc1fed59 100644 --- a/codegen/testserver/followschema/directive.generated.go +++ b/codegen/testserver/followschema/directive.generated.go @@ -23,104 +23,275 @@ 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{}{} - 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 - } + arg0, err := ec.dir_length_argsMin(ctx, rawArgs) + if err != nil { + return nil, err } args["min"] = arg0 - 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 - } + arg1, err := ec.dir_length_argsMax(ctx, rawArgs) + if err != nil { + return nil, err } args["max"] = arg1 - 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 - } + arg2, err := ec.dir_length_argsMessage(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.dir_logged_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.dir_order1_argsLocation(ctx, rawArgs) + 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{}{} - 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 - } + 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")) + 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 + } + 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) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *int - if tmp, ok := rawArgs["min"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.dir_range_argsMin(ctx, rawArgs) + if err != nil { + return nil, err } args["min"] = arg0 - 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 - } + arg1, err := ec.dir_range_argsMax(ctx, rawArgs) + 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 ***************************** @@ -175,21 +346,26 @@ 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 { - return nil, err + var zeroVal string + return zeroVal, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, max, message) } @@ -248,9 +424,11 @@ 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 { - return nil, errors.New("directive toNull is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -388,9 +566,11 @@ 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 { - return nil, errors.New("directive toNull is not implemented") + var zeroVal string + return zeroVal, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -450,17 +630,21 @@ 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 { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, nil, message) } @@ -498,27 +682,33 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal string + return zeroVal, 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 { - return nil, err + var zeroVal string + return zeroVal, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, message) } @@ -536,15 +726,18 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *string + return zeroVal, 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 { - return nil, errors.New("directive toNull is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive1) } @@ -566,9 +759,11 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *InnerDirectives + return zeroVal, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -590,9 +785,11 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *InnerDirectives + return zeroVal, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -614,23 +811,28 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *ThirdParty + return zeroVal, 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 { - return nil, err + var zeroVal *ThirdParty + return zeroVal, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - return nil, err + var zeroVal *ThirdParty + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal *ThirdParty + return zeroVal, 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 1707838fa3f..7d1e3515f64 100644 --- a/codegen/testserver/followschema/directive.graphql +++ b/codegen/testserver/followschema/directive.graphql @@ -3,6 +3,7 @@ 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 @@ -10,10 +11,14 @@ directive @unimplemented on FIELD_DEFINITION directive @order1(location: String!) repeatable on FIELD_DEFINITION | OBJECT directive @order2(location: String!) on OBJECT directive @concurrent 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 9924e421f3c..d77f0498d57 100644 --- a/codegen/testserver/followschema/directive_test.go +++ b/codegen/testserver/followschema/directive_test.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "reflect" "slices" "testing" @@ -15,6 +16,17 @@ 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) { @@ -36,6 +48,14 @@ 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 } @@ -174,6 +194,21 @@ 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) }, @@ -264,6 +299,17 @@ 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 cdd848e9641..c508adaa88c 100644 --- a/codegen/testserver/followschema/panics.generated.go +++ b/codegen/testserver/followschema/panics.generated.go @@ -27,32 +27,66 @@ 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{}{} - 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 - } + arg0, err := ec.field_Panics_argUnmarshal_argsU(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Panics_fieldFuncMarshal_argsU(ctx, rawArgs) + 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 0fdfe743bae..3f4ff75bdcc 100644 --- a/codegen/testserver/followschema/prelude.generated.go +++ b/codegen/testserver/followschema/prelude.generated.go @@ -24,32 +24,66 @@ 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 f39a4690b8e..94bd8816caa 100644 --- a/codegen/testserver/followschema/resolver.go +++ b/codegen/testserver/followschema/resolver.go @@ -217,6 +217,11 @@ 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 777d0edd403..92c979f64e1 100644 --- a/codegen/testserver/followschema/root_.generated.go +++ b/codegen/testserver/followschema/root_.generated.go @@ -64,8 +64,10 @@ 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) @@ -343,6 +345,7 @@ 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 @@ -1419,6 +1422,18 @@ 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 919204db581..acd63dc8f58 100644 --- a/codegen/testserver/followschema/schema.generated.go +++ b/codegen/testserver/followschema/schema.generated.go @@ -53,6 +53,7 @@ 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,617 +129,1331 @@ 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{}{} - 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 - } + arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) + if err != nil { + return nil, err } args["if"] = arg0 - 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 - } + 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_Pet_friends_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *int - if tmp, ok := rawArgs["limit"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("limit")) - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Pet_friends_argsLimit(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_defaultParameters_argsFalsyBoolean(ctx, rawArgs) + if err != nil { + return nil, err } args["falsyBoolean"] = arg0 - 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 - } + arg1, err := ec.field_Query_defaultParameters_argsTruthyBoolean(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_defaultScalar_argsArg(ctx, rawArgs) + 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{}{} - 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) + 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 } + return ec.unmarshalNString2string(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal string + return zeroVal, err } - 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)) + 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") } + 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{}{} - 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 - } + arg0, err := ec.field_Query_directiveFieldDef_argsRet(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_directiveInputNullable_argsArg(ctx, rawArgs) + 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{}{} - 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) - } - 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) + 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 } + return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐInnerInput(ctx, 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)) + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.Custom == nil { + var zeroVal InnerInput + return zeroVal, errors.New("directive custom is not implemented") } + 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)) } - 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{}{} - 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 - } + arg0, err := ec.field_Query_directiveInput_argsArg(ctx, rawArgs) + 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{}{} - 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) + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) + + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) + + 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 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") + } + 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 } + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + value, err := ec.unmarshalNString2string(ctx, "test") if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *string + return zeroVal, 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)) + 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)) } - 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{}{} - 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 - } + arg0, err := ec.field_Query_enumInInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_fallback_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + 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")) + 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{}{} - 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 - } + arg0, err := ec.field_Query_inputOmittable_argsArg(ctx, rawArgs) + 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 +} 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("arg")) - arg0, err = ec.unmarshalNString2ᚕstringᚄ(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.field_Query_inputSlice_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_mapInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_mapNestedStringInterface_argsIn(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_mapStringInterface_argsIn(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_nestedInputs_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_nullableArg_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_recursive_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_user_argsID(ctx, rawArgs) + 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{}{} - 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) + 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 } + return ec.unmarshalNString2string(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal string + return zeroVal, err } - 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)) + 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") } + 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{}{} - 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) + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) + + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) - } - tmp, err = directive1(ctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + 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 } - 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.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") } + 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{}{} - 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 - } + arg0, err := ec.field_User_pets_argsLimit(ctx, rawArgs) + 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 ***************************** @@ -2480,6 +3195,55 @@ 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 { @@ -2644,43 +3408,52 @@ 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order1 == nil { - return nil, errors.New("directive order1 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order1 == nil { - return nil, errors.New("directive order1 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order2 == nil { - return nil, errors.New("directive order2 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order1 == nil { - return nil, errors.New("directive order1 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive3, location) } @@ -2786,17 +3559,21 @@ 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 { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, nil, directive0, min, nil, message) } @@ -2904,15 +3681,18 @@ 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 { - return nil, errors.New("directive directive1 is not implemented") + var zeroVal *string + return zeroVal, 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 { - return nil, errors.New("directive directive2 is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -2968,9 +3748,11 @@ 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 { - return nil, errors.New("directive unimplemented is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -3026,9 +3808,11 @@ func (ec *executionContext) _Query_directiveConcurrent(ctx context.Context, fiel ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveConcurrent(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Concurrent == nil { - return nil, errors.New("directive concurrent is not implemented") + var zeroVal []*ObjectDirectivesConcurrent + return zeroVal, errors.New("directive concurrent is not implemented") } return ec.directives.Concurrent(ctx, nil, directive0) } @@ -3307,9 +4091,11 @@ 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 { - return nil, errors.New("directive makeNil is not implemented") + var zeroVal Shape + return zeroVal, errors.New("directive makeNil is not implemented") } return ec.directives.MakeNil(ctx, nil, directive0) } @@ -3406,9 +4192,11 @@ 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 { - return nil, errors.New("directive makeTypedNil is not implemented") + var zeroVal Shape + return zeroVal, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -3464,9 +4252,11 @@ 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 { - return nil, errors.New("directive makeTypedNil is not implemented") + var zeroVal Animal + return zeroVal, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -5349,15 +6139,18 @@ 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 { - return nil, errors.New("directive directive1 is not implemented") + var zeroVal *string + return zeroVal, 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 { - return nil, errors.New("directive directive2 is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -5427,9 +6220,11 @@ 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 { - return nil, errors.New("directive unimplemented is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -6919,6 +7714,12 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Query_directiveNullableArg(ctx, field) }) + case "directiveSingleNullableArg": + field := field + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query_directiveSingleNullableArg(ctx, field) + }) case "directiveInputNullable": field := field diff --git a/codegen/testserver/followschema/stub.go b/codegen/testserver/followschema/stub.go index 3bdcbbc3d67..0a7eaedf85d 100644 --- a/codegen/testserver/followschema/stub.go +++ b/codegen/testserver/followschema/stub.go @@ -75,6 +75,7 @@ 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,6 +365,9 @@ 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 58e9a7e615b..83494c840ec 100644 --- a/codegen/testserver/followschema/validtypes.generated.go +++ b/codegen/testserver/followschema/validtypes.generated.go @@ -22,257 +22,741 @@ 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{}{} - 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 - } + arg0, err := ec.field_ValidType_validArgs_argsBreak(ctx, rawArgs) + if err != nil { + return nil, err } args["break"] = arg0 - 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 - } + arg1, err := ec.field_ValidType_validArgs_argsDefault(ctx, rawArgs) + if err != nil { + return nil, err } args["default"] = arg1 - 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 - } + arg2, err := ec.field_ValidType_validArgs_argsFunc(ctx, rawArgs) + if err != nil { + return nil, err } args["func"] = arg2 - 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 - } + arg3, err := ec.field_ValidType_validArgs_argsInterface(ctx, rawArgs) + if err != nil { + return nil, err } args["interface"] = arg3 - 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 - } + arg4, err := ec.field_ValidType_validArgs_argsSelect(ctx, rawArgs) + if err != nil { + return nil, err } args["select"] = arg4 - 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 - } + arg5, err := ec.field_ValidType_validArgs_argsCase(ctx, rawArgs) + if err != nil { + return nil, err } args["case"] = arg5 - 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 - } + arg6, err := ec.field_ValidType_validArgs_argsDefer(ctx, rawArgs) + if err != nil { + return nil, err } args["defer"] = arg6 - 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 - } + arg7, err := ec.field_ValidType_validArgs_argsGo(ctx, rawArgs) + if err != nil { + return nil, err } args["go"] = arg7 - 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 - } + arg8, err := ec.field_ValidType_validArgs_argsMap(ctx, rawArgs) + if err != nil { + return nil, err } args["map"] = arg8 - 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 - } + arg9, err := ec.field_ValidType_validArgs_argsStruct(ctx, rawArgs) + if err != nil { + return nil, err } args["struct"] = arg9 - 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 - } + arg10, err := ec.field_ValidType_validArgs_argsChan(ctx, rawArgs) + if err != nil { + return nil, err } args["chan"] = arg10 - 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 - } + arg11, err := ec.field_ValidType_validArgs_argsElse(ctx, rawArgs) + if err != nil { + return nil, err } args["else"] = arg11 - 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 - } + arg12, err := ec.field_ValidType_validArgs_argsGoto(ctx, rawArgs) + if err != nil { + return nil, err } args["goto"] = arg12 - 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 - } + arg13, err := ec.field_ValidType_validArgs_argsPackage(ctx, rawArgs) + if err != nil { + return nil, err } args["package"] = arg13 - 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 - } + arg14, err := ec.field_ValidType_validArgs_argsSwitch(ctx, rawArgs) + if err != nil { + return nil, err } args["switch"] = arg14 - 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 - } + arg15, err := ec.field_ValidType_validArgs_argsConst(ctx, rawArgs) + if err != nil { + return nil, err } args["const"] = arg15 - 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 - } + arg16, err := ec.field_ValidType_validArgs_argsFallthrough(ctx, rawArgs) + if err != nil { + return nil, err } args["fallthrough"] = arg16 - 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 - } + arg17, err := ec.field_ValidType_validArgs_argsIf(ctx, rawArgs) + if err != nil { + return nil, err } args["if"] = arg17 - 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 - } + arg18, err := ec.field_ValidType_validArgs_argsRange(ctx, rawArgs) + if err != nil { + return nil, err } args["range"] = arg18 - 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 - } + arg19, err := ec.field_ValidType_validArgs_argsType(ctx, rawArgs) + if err != nil { + return nil, err } args["type"] = arg19 - 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 - } + arg20, err := ec.field_ValidType_validArgs_argsContinue(ctx, rawArgs) + if err != nil { + return nil, err } args["continue"] = arg20 - 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 - } + arg21, err := ec.field_ValidType_validArgs_argsFor(ctx, rawArgs) + if err != nil { + return nil, err } args["for"] = arg21 - 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 - } + arg22, err := ec.field_ValidType_validArgs_argsImport(ctx, rawArgs) + if err != nil { + return nil, err } args["import"] = arg22 - 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 - } + arg23, err := ec.field_ValidType_validArgs_argsReturn(ctx, rawArgs) + if err != nil { + return nil, err } args["return"] = arg23 - 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 - } + arg24, err := ec.field_ValidType_validArgs_argsVar(ctx, rawArgs) + if err != nil { + return nil, err } args["var"] = arg24 - 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 - } + 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")) + 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{}{} - 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 - } + arg0, err := ec.field_ValidType_validInputKeywords_argsInput(ctx, rawArgs) + 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 7379d1e82ad..76ae0c79638 100644 --- a/codegen/testserver/followschema/variadic.generated.go +++ b/codegen/testserver/followschema/variadic.generated.go @@ -21,17 +21,34 @@ 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{}{} - 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 - } + arg0, err := ec.field_VariadicModel_value_argsRank(ctx, rawArgs) + 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 054fe85d799..b617122dde8 100644 --- a/codegen/testserver/followschema/wrapped_type.generated.go +++ b/codegen/testserver/followschema/wrapped_type.generated.go @@ -29,32 +29,66 @@ 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{}{} - 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 - } + arg0, err := ec.field_WrappedMap_get_argsKey(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_WrappedSlice_get_argsIdx(ctx, rawArgs) + 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 new file mode 100644 index 00000000000..44caa8eee25 --- /dev/null +++ b/codegen/testserver/nullabledirectives/directive.graphql @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000000..9d24fa6fe26 --- /dev/null +++ b/codegen/testserver/nullabledirectives/directive_test.go @@ -0,0 +1,75 @@ +//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 new file mode 100644 index 00000000000..997042ac33c --- /dev/null +++ b/codegen/testserver/nullabledirectives/generated/directive.generated.go @@ -0,0 +1,407 @@ +// 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 + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query_directiveSingleNullableArg(ctx, field) + }) + case "__type": + field := field + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query___type(ctx, field) + }) + case "__schema": + field := field + + 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 new file mode 100644 index 00000000000..3b1a4d208a9 --- /dev/null +++ b/codegen/testserver/nullabledirectives/generated/models/models-gen.go @@ -0,0 +1,6 @@ +// 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 new file mode 100644 index 00000000000..b8349b6ea9c --- /dev/null +++ b/codegen/testserver/nullabledirectives/generated/prelude.generated.go @@ -0,0 +1,3471 @@ +// 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": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Directive_name(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Directive_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Directive_description(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Directive_description(ctx, field, obj) + case "locations": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Directive_locations(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Directive_locations(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "args": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Directive_args(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Directive_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isRepeatable": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Directive_isRepeatable(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + 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": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___EnumValue_name(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___EnumValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___EnumValue_description(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___EnumValue_description(ctx, field, obj) + case "isDeprecated": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___EnumValue_isDeprecated(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___EnumValue_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___EnumValue_deprecationReason(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + 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": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Field_name(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Field_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Field_description(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Field_description(ctx, field, obj) + case "args": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Field_args(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Field_args(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "type": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Field_type(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Field_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "isDeprecated": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Field_isDeprecated(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Field_isDeprecated(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deprecationReason": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Field_deprecationReason(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + 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": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___InputValue_name(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___InputValue_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "description": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___InputValue_description(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___InputValue_description(ctx, field, obj) + case "type": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___InputValue_type(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___InputValue_type(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "defaultValue": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___InputValue_defaultValue(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + 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": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Schema_description(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Schema_description(ctx, field, obj) + case "types": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Schema_types(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Schema_types(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "queryType": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Schema_queryType(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Schema_queryType(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "mutationType": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Schema_mutationType(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Schema_mutationType(ctx, field, obj) + case "subscriptionType": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Schema_subscriptionType(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Schema_subscriptionType(ctx, field, obj) + case "directives": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Schema_directives(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + 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": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_kind(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_kind(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "name": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_name(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_name(ctx, field, obj) + case "description": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_description(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_description(ctx, field, obj) + case "fields": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_fields(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_fields(ctx, field, obj) + case "interfaces": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_interfaces(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_interfaces(ctx, field, obj) + case "possibleTypes": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_possibleTypes(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_possibleTypes(ctx, field, obj) + case "enumValues": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_enumValues(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_enumValues(ctx, field, obj) + case "inputFields": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_inputFields(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_inputFields(ctx, field, obj) + case "ofType": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_ofType(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Values[i] = ec.___Type_ofType(ctx, field, obj) + case "specifiedByURL": + field := field + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return ec.___Type_specifiedByURL(ctx, field, obj) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + 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 := true + 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 := true + 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 := true + 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 := true + 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 := true + 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 := true + 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 := true + 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 := true + 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 new file mode 100644 index 00000000000..7308cae6cb2 --- /dev/null +++ b/codegen/testserver/nullabledirectives/generated/resolvers/resolver.go @@ -0,0 +1,21 @@ +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 new file mode 100644 index 00000000000..717c9030bfd --- /dev/null +++ b/codegen/testserver/nullabledirectives/generated/root_.generated.go @@ -0,0 +1,179 @@ +// 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 new file mode 100644 index 00000000000..657e9d04123 --- /dev/null +++ b/codegen/testserver/nullabledirectives/gqlgen.yml @@ -0,0 +1,16 @@ +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 new file mode 100644 index 00000000000..507cfab34da --- /dev/null +++ b/codegen/testserver/nullabledirectives/stub.go @@ -0,0 +1,25 @@ +// 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/directive.graphql b/codegen/testserver/singlefile/directive.graphql index 1707838fa3f..7d1e3515f64 100644 --- a/codegen/testserver/singlefile/directive.graphql +++ b/codegen/testserver/singlefile/directive.graphql @@ -3,6 +3,7 @@ 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 @@ -10,10 +11,14 @@ directive @unimplemented on FIELD_DEFINITION directive @order1(location: String!) repeatable on FIELD_DEFINITION | OBJECT directive @order2(location: String!) on OBJECT directive @concurrent 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/singlefile/directive_test.go b/codegen/testserver/singlefile/directive_test.go index c666e3e60f4..112940c2a52 100644 --- a/codegen/testserver/singlefile/directive_test.go +++ b/codegen/testserver/singlefile/directive_test.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "reflect" "slices" "testing" @@ -15,6 +16,17 @@ 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) { @@ -36,6 +48,14 @@ 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 } @@ -174,6 +194,21 @@ 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) }, @@ -264,6 +299,17 @@ 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) { @@ -476,7 +522,6 @@ func TestDirectives(t *testing.T) { err := c.WebsocketOnce(`subscription { directiveNullableArg }`, &resp) require.NoError(t, err) - require.NotNil(t, resp.DirectiveNullableArg) require.Equal(t, "Ok", *resp.DirectiveNullableArg) }) t.Run("when function success on valid nullable arg directives", func(t *testing.T) { @@ -487,7 +532,6 @@ func TestDirectives(t *testing.T) { err := c.WebsocketOnce(`subscription { directiveNullableArg(arg: 1) }`, &resp) require.NoError(t, err) - require.NotNil(t, resp.DirectiveNullableArg) require.Equal(t, "Ok", *resp.DirectiveNullableArg) }) t.Run("when function success", func(t *testing.T) { @@ -498,7 +542,6 @@ func TestDirectives(t *testing.T) { err := c.WebsocketOnce(`subscription { directiveArg(arg: "test") }`, &resp) require.NoError(t, err) - require.NotNil(t, resp.DirectiveArg) require.Equal(t, "Ok", *resp.DirectiveArg) }) }) diff --git a/codegen/testserver/singlefile/generated.go b/codegen/testserver/singlefile/generated.go index af0006a45b5..60d0fb95053 100644 --- a/codegen/testserver/singlefile/generated.go +++ b/codegen/testserver/singlefile/generated.go @@ -73,8 +73,10 @@ 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) @@ -352,6 +354,7 @@ 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 @@ -560,6 +563,7 @@ 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) @@ -1572,6 +1576,18 @@ 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 @@ -2500,1139 +2516,2695 @@ 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{}{} - 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 - } + arg0, err := ec.dir_defer_argsIf(ctx, rawArgs) + if err != nil { + return nil, err } args["if"] = arg0 - 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 - } + 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) dir_length_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 int - if tmp, ok := rawArgs["min"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - arg0, err = ec.unmarshalNInt2int(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.dir_length_argsMin(ctx, rawArgs) + if err != nil { + return nil, err } args["min"] = arg0 - 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 - } + arg1, err := ec.dir_length_argsMax(ctx, rawArgs) + if err != nil { + return nil, err } args["max"] = arg1 - 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 - } + arg2, err := ec.dir_length_argsMessage(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.dir_logged_argsID(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.dir_order1_argsLocation(ctx, rawArgs) + 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{}{} - 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 - } + 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")) + 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 + } + 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) dir_range_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) { var err error args := map[string]interface{}{} - var arg0 *int - if tmp, ok := rawArgs["min"]; ok { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("min")) - arg0, err = ec.unmarshalOInt2ᚖint(ctx, tmp) - if err != nil { - return nil, err - } + arg0, err := ec.dir_range_argsMin(ctx, rawArgs) + if err != nil { + return nil, err } args["min"] = arg0 - 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 - } + arg1, err := ec.dir_range_argsMax(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_defaultInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_overrideValueViaInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_updatePtrToPtr_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Mutation_updateSomething_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Panics_argUnmarshal_argsU(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Panics_fieldFuncMarshal_argsU(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Pet_friends_argsLimit(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_defaultParameters_argsFalsyBoolean(ctx, rawArgs) + if err != nil { + return nil, err } args["falsyBoolean"] = arg0 - 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 - } + arg1, err := ec.field_Query_defaultParameters_argsTruthyBoolean(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_defaultScalar_argsArg(ctx, rawArgs) + 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{}{} - 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) + 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 } + return ec.unmarshalNString2string(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal string + return zeroVal, err } - 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)) + 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") + } + 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{}{} - 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 - } + arg0, err := ec.field_Query_directiveFieldDef_argsRet(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_directiveInputNullable_argsArg(ctx, rawArgs) + 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{}{} - 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) - } - 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) + 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 } + return ec.unmarshalNInnerInput2githubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐInnerInput(ctx, 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)) + directive1 := func(ctx context.Context) (interface{}, error) { + if ec.directives.Custom == nil { + var zeroVal InnerInput + return zeroVal, errors.New("directive custom is not implemented") } + 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)) } - 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{}{} - 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 - } + arg0, err := ec.field_Query_directiveInput_argsArg(ctx, rawArgs) + 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{}{} - 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) + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) + + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) + + 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 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") + } + 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 } + return ec.unmarshalOString2ᚖstring(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + value, err := ec.unmarshalNString2string(ctx, "test") if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *string + return zeroVal, 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)) + 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)) } - 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{}{} - 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 - } + arg0, err := ec.field_Query_enumInInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_fallback_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + 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")) + 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{}{} - 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 - } + arg0, err := ec.field_Query_inputOmittable_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_inputSlice_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_mapInput_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_mapNestedStringInterface_argsIn(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_mapStringInterface_argsIn(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_nestedInputs_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_nullableArg_argsArg(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_recursive_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_user_argsID(ctx, rawArgs) + 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{}{} - 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) + 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 } + return ec.unmarshalNString2string(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalNInt2int(ctx, 1) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal string + return zeroVal, err } - 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)) + 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") } + 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{}{} - 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) + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) + + 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 } + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } - tmp, err = directive1(ctx) + directive1 := func(ctx context.Context) (interface{}, error) { + min, err := ec.unmarshalOInt2ᚖint(ctx, 0) if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + var zeroVal *int + return zeroVal, err } - 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)) + 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) } - 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) - } - tmp, err = directive1(ctx) - if err != nil { - return nil, graphql.ErrorOnPath(ctx, err) + 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 } - 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.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") } + 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{}{} - 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 - } + arg0, err := ec.field_User_pets_argsLimit(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_ValidType_validArgs_argsBreak(ctx, rawArgs) + if err != nil { + return nil, err } args["break"] = arg0 - 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 - } + arg1, err := ec.field_ValidType_validArgs_argsDefault(ctx, rawArgs) + if err != nil { + return nil, err } args["default"] = arg1 - 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 - } + arg2, err := ec.field_ValidType_validArgs_argsFunc(ctx, rawArgs) + if err != nil { + return nil, err } args["func"] = arg2 - 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 - } + arg3, err := ec.field_ValidType_validArgs_argsInterface(ctx, rawArgs) + if err != nil { + return nil, err } args["interface"] = arg3 - 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 - } + arg4, err := ec.field_ValidType_validArgs_argsSelect(ctx, rawArgs) + if err != nil { + return nil, err } args["select"] = arg4 - 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 - } + arg5, err := ec.field_ValidType_validArgs_argsCase(ctx, rawArgs) + if err != nil { + return nil, err } args["case"] = arg5 - 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 - } + arg6, err := ec.field_ValidType_validArgs_argsDefer(ctx, rawArgs) + if err != nil { + return nil, err } args["defer"] = arg6 - 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 - } + arg7, err := ec.field_ValidType_validArgs_argsGo(ctx, rawArgs) + if err != nil { + return nil, err } args["go"] = arg7 - 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 - } + arg8, err := ec.field_ValidType_validArgs_argsMap(ctx, rawArgs) + if err != nil { + return nil, err } args["map"] = arg8 - 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 - } + arg9, err := ec.field_ValidType_validArgs_argsStruct(ctx, rawArgs) + if err != nil { + return nil, err } args["struct"] = arg9 - 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 - } + arg10, err := ec.field_ValidType_validArgs_argsChan(ctx, rawArgs) + if err != nil { + return nil, err } args["chan"] = arg10 - 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 - } + arg11, err := ec.field_ValidType_validArgs_argsElse(ctx, rawArgs) + if err != nil { + return nil, err } args["else"] = arg11 - var arg12 string + 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")) + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("goto")) - arg12, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["goto"] = arg12 - var arg13 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("package")) - arg13, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["package"] = arg13 - var arg14 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("switch")) - arg14, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["switch"] = arg14 - var arg15 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("const")) - arg15, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["const"] = arg15 - var arg16 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("fallthrough")) - arg16, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["fallthrough"] = arg16 - var arg17 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("if")) - arg17, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["if"] = arg17 - var arg18 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("range")) - arg18, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["range"] = arg18 - var arg19 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("type")) - arg19, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["type"] = arg19 - var arg20 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("continue")) - arg20, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["continue"] = arg20 - var arg21 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("for")) - arg21, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["for"] = arg21 - var arg22 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("import")) - arg22, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["import"] = arg22 - var arg23 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("return")) - arg23, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["return"] = arg23 - var arg24 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("var")) - arg24, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["var"] = arg24 - var arg25 string + + 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 { - ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("_")) - arg25, err = ec.unmarshalNString2string(ctx, tmp) - if err != nil { - return nil, err - } + return ec.unmarshalNString2string(ctx, tmp) } - args["_"] = arg25 - return args, nil + + 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{}{} - 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 - } + arg0, err := ec.field_ValidType_validInputKeywords_argsInput(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_VariadicModel_value_argsRank(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_WrappedMap_get_argsKey(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_WrappedSlice_get_argsIdx(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 ***************************** @@ -6859,21 +8431,26 @@ 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 { - return nil, err + var zeroVal string + return zeroVal, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, max, message) } @@ -6932,9 +8509,11 @@ 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 { - return nil, errors.New("directive toNull is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -7072,9 +8651,11 @@ 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 { - return nil, errors.New("directive toNull is not implemented") + var zeroVal string + return zeroVal, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive0) } @@ -9152,6 +10733,55 @@ 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 { @@ -9316,43 +10946,52 @@ 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order1 == nil { - return nil, errors.New("directive order1 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order1 == nil { - return nil, errors.New("directive order1 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order2 == nil { - return nil, errors.New("directive order2 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, 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 { - return nil, err + var zeroVal *ObjectDirectives + return zeroVal, err } if ec.directives.Order1 == nil { - return nil, errors.New("directive order1 is not implemented") + var zeroVal *ObjectDirectives + return zeroVal, errors.New("directive order1 is not implemented") } return ec.directives.Order1(ctx, nil, directive3, location) } @@ -9458,17 +11097,21 @@ 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 { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, nil, directive0, min, nil, message) } @@ -9576,15 +11219,18 @@ 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 { - return nil, errors.New("directive directive1 is not implemented") + var zeroVal *string + return zeroVal, 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 { - return nil, errors.New("directive directive2 is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -9640,9 +11286,11 @@ 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 { - return nil, errors.New("directive unimplemented is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -9698,9 +11346,11 @@ func (ec *executionContext) _Query_directiveConcurrent(ctx context.Context, fiel ctx = rctx // use context from middleware stack in children return ec.resolvers.Query().DirectiveConcurrent(rctx) } + directive1 := func(ctx context.Context) (interface{}, error) { if ec.directives.Concurrent == nil { - return nil, errors.New("directive concurrent is not implemented") + var zeroVal []*ObjectDirectivesConcurrent + return zeroVal, errors.New("directive concurrent is not implemented") } return ec.directives.Concurrent(ctx, nil, directive0) } @@ -9979,9 +11629,11 @@ 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 { - return nil, errors.New("directive makeNil is not implemented") + var zeroVal Shape + return zeroVal, errors.New("directive makeNil is not implemented") } return ec.directives.MakeNil(ctx, nil, directive0) } @@ -10078,9 +11730,11 @@ 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 { - return nil, errors.New("directive makeTypedNil is not implemented") + var zeroVal Shape + return zeroVal, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -10136,9 +11790,11 @@ 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 { - return nil, errors.New("directive makeTypedNil is not implemented") + var zeroVal Animal + return zeroVal, errors.New("directive makeTypedNil is not implemented") } return ec.directives.MakeTypedNil(ctx, nil, directive0) } @@ -12419,15 +14075,18 @@ 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 { - return nil, errors.New("directive directive1 is not implemented") + var zeroVal *string + return zeroVal, 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 { - return nil, errors.New("directive directive2 is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive directive2 is not implemented") } return ec.directives.Directive2(ctx, nil, directive1) } @@ -12497,9 +14156,11 @@ 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 { - return nil, errors.New("directive unimplemented is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive unimplemented is not implemented") } return ec.directives.Unimplemented(ctx, nil, directive0) } @@ -15363,17 +17024,21 @@ 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 { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive0, min, nil, message) } @@ -15438,27 +17103,33 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal string + return zeroVal, 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 { - return nil, err + var zeroVal string + return zeroVal, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } message, err := ec.unmarshalOString2ᚖstring(ctx, "not valid") if err != nil { - return nil, err + var zeroVal string + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal string + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, message) } @@ -15476,15 +17147,18 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *string + return zeroVal, 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 { - return nil, errors.New("directive toNull is not implemented") + var zeroVal *string + return zeroVal, errors.New("directive toNull is not implemented") } return ec.directives.ToNull(ctx, obj, directive1) } @@ -15506,9 +17180,11 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *InnerDirectives + return zeroVal, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -15530,9 +17206,11 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *InnerDirectives + return zeroVal, errors.New("directive directive3 is not implemented") } return ec.directives.Directive3(ctx, obj, directive0) } @@ -15554,23 +17232,28 @@ 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 { - return nil, errors.New("directive directive3 is not implemented") + var zeroVal *ThirdParty + return zeroVal, 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 { - return nil, err + var zeroVal *ThirdParty + return zeroVal, err } max, err := ec.unmarshalOInt2ᚖint(ctx, 7) if err != nil { - return nil, err + var zeroVal *ThirdParty + return zeroVal, err } if ec.directives.Length == nil { - return nil, errors.New("directive length is not implemented") + var zeroVal *ThirdParty + return zeroVal, errors.New("directive length is not implemented") } return ec.directives.Length(ctx, obj, directive1, min, max, nil) } @@ -20721,6 +22404,12 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { return ec._Query_directiveNullableArg(ctx, field) }) + case "directiveSingleNullableArg": + field := field + + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Query_directiveSingleNullableArg(ctx, field) + }) case "directiveInputNullable": field := field diff --git a/codegen/testserver/singlefile/resolver.go b/codegen/testserver/singlefile/resolver.go index 2301bfdb5ab..89a37561ab1 100644 --- a/codegen/testserver/singlefile/resolver.go +++ b/codegen/testserver/singlefile/resolver.go @@ -217,6 +217,11 @@ 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/singlefile/stub.go b/codegen/testserver/singlefile/stub.go index 7a14571b816..61b02179a0a 100644 --- a/codegen/testserver/singlefile/stub.go +++ b/codegen/testserver/singlefile/stub.go @@ -75,6 +75,7 @@ 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,6 +365,9 @@ 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/docs/content/config.md b/docs/content/config.md index 2a73b0c829c..6972cebec44 100644 --- a/docs/content/config.md +++ b/docs/content/config.md @@ -81,6 +81,16 @@ 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 88fa721997d..4235e51ad9b 100644 --- a/integration/server/generated.go +++ b/integration/server/generated.go @@ -368,122 +368,258 @@ 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{}{} - 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 - } + arg0, err := ec.dir_magic_argsKind(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query_coercion_argsValue(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_complexity_argsValue(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_date_argsFilter(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Query_error_argsType(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 e74f668d097..c61cd4dd7b4 100644 --- a/plugin/federation/testdata/entityresolver/generated/exec.go +++ b/plugin/federation/testdata/entityresolver/generated/exec.go @@ -872,329 +872,723 @@ 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{}{} - 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 - } + arg0, err := ec.dir_entityResolver_argsMulti(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findHelloByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1(ctx, rawArgs) + if err != nil { + return nil, err } args["key1"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findHelloWithErrorsByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloRequiresByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloWithErrorByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findPlanetMultipleRequiresByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findPlanetRequiresByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findPlanetRequiresNestedByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsHelloName(ctx, rawArgs) + if err != nil { + return nil, err } args["helloName"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsFoo(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldNameByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldWithMultipleKeysByBar_argsBar(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName(ctx, rawArgs) + if err != nil { + return nil, err } args["helloName"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 ***************************** @@ -1402,13 +1796,16 @@ 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 { - return nil, err + var zeroVal []*model.MultiHello + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*model.MultiHello + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1482,13 +1879,16 @@ 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 { - return nil, err + var zeroVal []*model.MultiHelloMultipleRequires + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*model.MultiHelloMultipleRequires + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1568,13 +1968,16 @@ 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 { - return nil, err + var zeroVal []*model.MultiHelloRequires + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*model.MultiHelloRequires + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1652,13 +2055,16 @@ 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 { - return nil, err + var zeroVal []*model.MultiHelloWithError + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*model.MultiHelloWithError + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1732,13 +2138,16 @@ 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 { - return nil, err + var zeroVal []*model.MultiPlanetRequiresNested + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*model.MultiPlanetRequiresNested + return zeroVal, 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 ae3dedae50b..b3460c56916 100644 --- a/plugin/federation/testdata/explicitrequires/generated/exec.go +++ b/plugin/federation/testdata/explicitrequires/generated/exec.go @@ -325,329 +325,723 @@ 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{}{} - 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 - } + arg0, err := ec.dir_entityResolver_argsMulti(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findHelloByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey1(ctx, rawArgs) + if err != nil { + return nil, err } args["key1"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findHelloMultiSingleKeysByKey1AndKey2_argsKey2(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findHelloWithErrorsByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloMultipleRequiresByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloRequiresByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiHelloWithErrorByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findManyMultiPlanetRequiresNestedByNames_argsReps(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findPlanetMultipleRequiresByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findPlanetRequiresByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findPlanetRequiresNestedByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsHelloName(ctx, rawArgs) + if err != nil { + return nil, err } args["helloName"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findWorldByHelloNameAndFoo_argsFoo(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldNameByName_argsName(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldWithMultipleKeysByBar_argsBar(ctx, rawArgs) + 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{}{} - 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 - } + arg0, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsHelloName(ctx, rawArgs) + if err != nil { + return nil, err } args["helloName"] = arg0 - 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 - } + arg1, err := ec.field_Entity_findWorldWithMultipleKeysByHelloNameAndFoo_argsFoo(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + arg0, err := ec.field_Query__entities_argsRepresentations(ctx, rawArgs) + 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{}{} - 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 - } + 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) { + // We won't call the directive 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{}{} - 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 - } + 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) { + // We won't call the directive 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 ***************************** @@ -855,13 +1249,16 @@ 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 { - return nil, err + var zeroVal []*MultiHello + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*MultiHello + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -935,13 +1332,16 @@ 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 { - return nil, err + var zeroVal []*MultiHelloMultipleRequires + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*MultiHelloMultipleRequires + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1021,13 +1421,16 @@ 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 { - return nil, err + var zeroVal []*MultiHelloRequires + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*MultiHelloRequires + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1105,13 +1508,16 @@ 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 { - return nil, err + var zeroVal []*MultiHelloWithError + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*MultiHelloWithError + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) } @@ -1185,13 +1591,16 @@ 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 { - return nil, err + var zeroVal []*MultiPlanetRequiresNested + return zeroVal, err } if ec.directives.EntityResolver == nil { - return nil, errors.New("directive entityResolver is not implemented") + var zeroVal []*MultiPlanetRequiresNested + return zeroVal, errors.New("directive entityResolver is not implemented") } return ec.directives.EntityResolver(ctx, nil, directive0, multi) }