encoding/openapi: convert CUE to openapi schemas

Change-Id: Iea3369d702f7cb91e49e61153518c04d6845f03c
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2120
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/encoding/openapi/testdata/openapi.cue b/encoding/openapi/testdata/openapi.cue
new file mode 100644
index 0000000..c4308e8
--- /dev/null
+++ b/encoding/openapi/testdata/openapi.cue
@@ -0,0 +1,39 @@
+package openapi
+
+// MyMessage is my message.
+MyMessage: {
+	port?: Port & {} @protobuf(1)
+
+	foo: Int32 & >10 & <1000 & int32 @protobuf(2)
+
+	bar: [...string] @protobuf(3)
+}
+
+MyMessage: {
+	// Field a.
+	a: 1
+} | {
+	b: string //2: crash
+}
+
+YourMessage: ({a: number} | {b: string} | {b: number}) & {a?: string}
+
+YourMessage2: ({a: number} | {b: number}) &
+	({c: number} | {d: number}) &
+	({e: number} | {f: number})
+
+Msg2: {b: number} | {a: string}
+
+Int32: int32
+
+Enum: "foo" | "bar" | "baz"
+
+List: [...number] | *[1, 2, 3]
+
+DefaultStruct: Port | *{port: 1}
+
+Port: {
+	port: int
+
+	obj: [...int]
+}