Skip to content

Commit

Permalink
skip searching directives when entity is found
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravi committed Feb 4, 2020
1 parent f52da8f commit fb3a6f4
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions plugin/modelgen/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,15 @@ func (m *Plugin) MutateConfig(cfg *config.Config) error {
PackageName: cfg.Model.Package,
}

var hasEntity bool
hasEntity := false
for _, schemaType := range cfg.Schema.Types {
if cfg.Models.UserDefined(schemaType.Name) {
continue
}
var ent bool
for _, dir := range schemaType.Directives {
if dir.Name == "key" {
hasEntity = true
ent = true
}
ent := false
if schemaType.Directives.ForName("key") != nil {
hasEntity = true
ent = true
}
switch schemaType.Kind {
case ast.Interface, ast.Union:
Expand Down

0 comments on commit fb3a6f4

Please sign in to comment.