diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-09 21:45:24 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-04-09 21:45:24 +0200 |
commit | 26b5343e2160de172969e6834074cf8482ceb845 (patch) | |
tree | 04f27aa660a903d65f7b3d951bd1c6f92c59c0c3 /vendor/github.com/99designs/gqlgen/codegen/directive_build.go | |
parent | 6e8496f4c1767ca8a8b95716a04f1b492bef7397 (diff) | |
download | git-bug-26b5343e2160de172969e6834074cf8482ceb845.tar.gz |
Update Gopkg.*
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/directive_build.go')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/codegen/directive_build.go | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/directive_build.go b/vendor/github.com/99designs/gqlgen/codegen/directive_build.go deleted file mode 100644 index af77dc44..00000000 --- a/vendor/github.com/99designs/gqlgen/codegen/directive_build.go +++ /dev/null @@ -1,48 +0,0 @@ -package codegen - -import ( - "sort" - - "github.com/pkg/errors" -) - -func (cfg *Config) buildDirectives(types NamedTypes) ([]*Directive, error) { - var directives []*Directive - - for name, dir := range cfg.schema.Directives { - if name == "skip" || name == "include" || name == "deprecated" { - continue - } - - var args []FieldArgument - for _, arg := range dir.Arguments { - newArg := FieldArgument{ - GQLName: arg.Name, - Type: types.getType(arg.Type), - GoVarName: sanitizeArgName(arg.Name), - } - - if !newArg.Type.IsInput && !newArg.Type.IsScalar { - return nil, errors.Errorf("%s cannot be used as argument of directive %s(%s) only input and scalar types are allowed", arg.Type, dir.Name, arg.Name) - } - - if arg.DefaultValue != nil { - var err error - newArg.Default, err = arg.DefaultValue.Value(nil) - if err != nil { - return nil, errors.Errorf("default value for directive argument %s(%s) is not valid: %s", dir.Name, arg.Name, err.Error()) - } - } - args = append(args, newArg) - } - - directives = append(directives, &Directive{ - Name: name, - Args: args, - }) - } - - sort.Slice(directives, func(i, j int) bool { return directives[i].Name < directives[j].Name }) - - return directives, nil -} |