From bd353b3e227f9dadd923ed49bc1a0ddb0c043865 Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Tue, 26 Nov 2019 15:17:09 +0300 Subject: [PATCH] add skip_validation flag --- api/generate.go | 6 ++++-- codegen/config/config.go | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/generate.go b/api/generate.go index e0238e5602..98376251a9 100644 --- a/api/generate.go +++ b/api/generate.go @@ -54,8 +54,10 @@ func Generate(cfg *config.Config, option ...Option) error { } } - if err := validate(cfg); err != nil { - return errors.Wrap(err, "validation failed") + if !cfg.SkipValidation { + if err := validate(cfg); err != nil { + return errors.Wrap(err, "validation failed") + } } return nil diff --git a/codegen/config/config.go b/codegen/config/config.go index 45f8a7bd81..3e9d7daeb2 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -29,6 +29,7 @@ type Config struct { StructTag string `yaml:"struct_tag,omitempty"` Directives map[string]DirectiveConfig `yaml:"directives,omitempty"` OmitSliceElementPointers bool `yaml:"omit_slice_element_pointers,omitempty"` + SkipValidation bool `yaml:"skip_validation,omitempty"` } var cfgFilenames = []string{".gqlgen.yml", "gqlgen.yml", "gqlgen.yaml"}