Skip to content

Commit

Permalink
chore(deps): Update github.com/99designs/gqlgen and github.com/vektah…
Browse files Browse the repository at this point in the history
…/gqlparser/v2 (#69)
  • Loading branch information
carstendietrich authored Jul 4, 2023
1 parent 2493e20 commit 2f089df
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 218 deletions.
12 changes: 12 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/99designs/gqlgen/codegen"
"github.com/99designs/gqlgen/codegen/config"
gqltemplates "github.com/99designs/gqlgen/codegen/templates"
plugin2 "github.com/99designs/gqlgen/plugin"
"github.com/spf13/cobra"
"github.com/vektah/gqlparser/v2/ast"
)
Expand Down Expand Up @@ -152,6 +153,10 @@ func Generate(services []Service, basePath string, schemaBasePath string) error
return nil
}

var _ plugin2.CodeGenerator = &plugin{}
var _ plugin2.ConfigMutator = &plugin{}
var _ plugin2.Plugin = &plugin{}

type plugin struct {
types *Types
}
Expand All @@ -166,6 +171,13 @@ func (m *plugin) MutateConfig(_ *config.Config) error {
}

func (m *plugin) GenerateCode(data *codegen.Data) error {
// Drop directives that can't be resolved, this was needed to ignore the `@defer` directive not used by us
for name := range data.AllDirectives {
if pkg := m.types.directives["@"+name][0]; pkg == "" {
delete(data.AllDirectives, name)
}
}

errored := false
defer func() {
if errored {
Expand Down
Loading

0 comments on commit 2f089df

Please sign in to comment.