diff --git a/codegen/config/config.go b/codegen/config/config.go index c7a7d4d8914..0d8ff5986df 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -38,17 +38,7 @@ func DefaultConfig() *Config { SchemaFilename: StringList{"schema.graphql"}, Model: PackageConfig{Filename: "models_gen.go"}, Exec: PackageConfig{Filename: "generated.go"}, - Directives: map[string]DirectiveConfig{ - "skip": { - SkipRuntime: true, - }, - "include": { - SkipRuntime: true, - }, - "deprecated": { - SkipRuntime: true, - }, - }, + Directives: map[string]DirectiveConfig{}, } } @@ -87,6 +77,18 @@ func LoadConfig(filename string) (*Config, error) { return nil, errors.Wrap(err, "unable to parse config") } + defaultDirectives := map[string]DirectiveConfig{ + "skip": {SkipRuntime: true}, + "include": {SkipRuntime: true}, + "deprecated": {SkipRuntime: true}, + } + + for key, value := range defaultDirectives { + if _, defined := config.Directives[key]; !defined { + config.Directives[key] = value + } + } + preGlobbing := config.SchemaFilename config.SchemaFilename = StringList{} for _, f := range preGlobbing {