Skip to content

Commit

Permalink
schema: no duplicated directive entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarkk committed Oct 14, 2021
1 parent b2baae2 commit 704a652
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions inject_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,24 @@ func (s *Schema) getDirectives() []qlDirective {
res := []qlDirective{}

for _, directiveLocation := range s.definedDirectives {
outerLoop:
for _, directive := range directiveLocation {
locations := make([]__DirectiveLocation, len(directive.Where))
for idx, location := range directive.Where {
locations[idx] = location.ToQlDirectiveLocation()
}

for _, entry := range res {
if entry.Name == directive.Name {
for _, directiveLocation := range locations {
for _, entryLocation := range entry.Locations {
if directiveLocation == entryLocation {
continue outerLoop
}
}
}
}
}
res = append(res, qlDirective{
Name: directive.Name,
Description: h.CheckStrPtr(directive.Description),
Expand Down

0 comments on commit 704a652

Please sign in to comment.