Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"reflect"
"regexp"
"sort"
"strings"

"github.com/graphql-go/graphql/language/ast"
)
Expand Down Expand Up @@ -588,6 +590,12 @@ func defineFieldMap(ttype Named, fieldMap Fields) (FieldDefinitionMap, error) {
}
fieldDef.Args = append(fieldDef.Args, fieldArg)
}

// Sort args so that their order is deterministic (alpha-numeric descending)
sort.Slice(fieldDef.Args, func(i, j int) bool {
return strings.Compare(fieldDef.Args[i].Name(), fieldDef.Args[j].Name()) == -1
})

resultFieldMap[fieldName] = fieldDef
}
return resultFieldMap, nil
Expand Down