encoding/openapi: sort schema alphabetically

This makes the output more stable and minimizes diffs.

Change-Id: I9f73f8aa26d65c41f7ba09d0ba04da9746a9299b
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5403
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/build.go b/encoding/openapi/build.go
index 2a90b8e..be55c39 100644
--- a/encoding/openapi/build.go
+++ b/encoding/openapi/build.go
@@ -136,6 +136,13 @@
 		}
 	}
 
+	a := c.schemas.Elts
+	sort.Slice(a, func(i, j int) bool {
+		x, _, _ := ast.LabelName(a[i].(*ast.Field).Label)
+		y, _, _ := ast.LabelName(a[j].(*ast.Field).Label)
+		return x < y
+	})
+
 	return (*ast.StructLit)(c.schemas), nil
 }