error if you try to use features that aren't done (fragments/interfaces)

This commit is contained in:
Ben Kraft
2021-04-02 16:19:50 -07:00
parent edb12e3e0a
commit 334c186944
3 changed files with 13 additions and 0 deletions
+7
View File
@@ -12,6 +12,9 @@ import (
"github.com/vektah/gqlparser/v2/formatter"
)
// Set to true to test features that aren't yet really ready.
var allowBrokenFeatures = false
var fileTemplate = mustTemplate("operation.go.tmpl")
// generator is the context for the codegen process (and ends up getting passed
@@ -168,6 +171,10 @@ func Generate(config *Config) (map[string][]byte, error) {
return nil, fmt.Errorf("no queries found in %v", config.Operations)
}
if len(document.Fragments) > 0 && !allowBrokenFeatures {
return nil, fmt.Errorf("genqlient does not yet support fragments")
}
g := newGenerator(config, schema)
for _, op := range document.Operations {
if err = g.addOperation(op); err != nil {