From c3a5a08a579ba4055656a93a90cda52f977e83fa Mon Sep 17 00:00:00 2001 From: Hiram Chirino Date: Sun, 10 Jul 2022 16:06:09 -0400 Subject: [PATCH] fix: introspection query would give results in random order. apply sorting on lists generated from maps. --- introspection.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/introspection.go b/introspection.go index 51feb42d..8bcf3364 100644 --- a/introspection.go +++ b/introspection.go @@ -426,6 +426,9 @@ func init() { for _, ttype := range schema.TypeMap() { results = append(results, ttype) } + sort.Slice(results, func(i, j int) bool { + return results[i].Name() < results[j].Name() + }) return results, nil } return []Type{}, nil @@ -558,6 +561,9 @@ func init() { } fields = append(fields, field) } + sort.Slice(fields, func(i, j int) bool { + return fields[i].Name < fields[j].Name + }) return fields, nil } return nil, nil @@ -618,6 +624,9 @@ func init() { for _, field := range ttype.Fields() { fields = append(fields, field) } + sort.Slice(fields, func(i, j int) bool { + return fields[i].PrivateName < fields[j].PrivateName + }) return fields, nil } return nil, nil