Skip to content

Commit c3a5a08

Browse files
committed
fix: introspection query would give results in random order.
apply sorting on lists generated from maps.
1 parent 09272f3 commit c3a5a08

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

introspection.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ func init() {
426426
for _, ttype := range schema.TypeMap() {
427427
results = append(results, ttype)
428428
}
429+
sort.Slice(results, func(i, j int) bool {
430+
return results[i].Name() < results[j].Name()
431+
})
429432
return results, nil
430433
}
431434
return []Type{}, nil
@@ -558,6 +561,9 @@ func init() {
558561
}
559562
fields = append(fields, field)
560563
}
564+
sort.Slice(fields, func(i, j int) bool {
565+
return fields[i].Name < fields[j].Name
566+
})
561567
return fields, nil
562568
}
563569
return nil, nil
@@ -618,6 +624,9 @@ func init() {
618624
for _, field := range ttype.Fields() {
619625
fields = append(fields, field)
620626
}
627+
sort.Slice(fields, func(i, j int) bool {
628+
return fields[i].PrivateName < fields[j].PrivateName
629+
})
621630
return fields, nil
622631
}
623632
return nil, nil

0 commit comments

Comments
 (0)