Skip to content

Commit

Permalink
Merge pull request 99designs#1006 from ravisastryk/entity-directives-…
Browse files Browse the repository at this point in the history
…lookup

skip searching directives when entity is found
  • Loading branch information
vektah authored Feb 4, 2020
2 parents f52da8f + fb3a6f4 commit 391cf51
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 391cf51

Please sign in to comment.