Skip to content

Commit

Permalink
fix: introspection query would give results in random order.
Browse files Browse the repository at this point in the history
apply sorting on lists generated from maps.
  • Loading branch information
chirino committed Jul 10, 2022
1 parent 09272f3 commit c3a5a08
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c3a5a08

Please sign in to comment.