diff --git a/codegen/directive_build.go b/codegen/directive_build.go index fcc8bdb0bfc..3282884112f 100644 --- a/codegen/directive_build.go +++ b/codegen/directive_build.go @@ -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 @@ -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 }