Skip to content

Commit

Permalink
Merge pull request 99designs#296 from heww/master
Browse files Browse the repository at this point in the history
sort directives by name when gen
  • Loading branch information
vektah authored Aug 21, 2018
2 parents 142457c + 28abe25 commit 4e9d32e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion codegen/directive_build.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package codegen

import "github.com/pkg/errors"
import (
"sort"

"github.com/pkg/errors"
)

func (cfg *Config) buildDirectives(types NamedTypes) ([]*Directive, error) {
var directives []*Directive
Expand Down Expand Up @@ -38,5 +42,8 @@ func (cfg *Config) buildDirectives(types NamedTypes) ([]*Directive, error) {
Args: args,
})
}

sort.Slice(directives, func(i, j int) bool { return directives[i].Name < directives[j].Name })

return directives, nil
}

0 comments on commit 4e9d32e

Please sign in to comment.