encoding/openapi: support nested defintitions
This perpares for Protobuf remodeling, where the nested
definitions of protobufs are are also nested within the
corresponding CUE types.
- Use Dereference
- Get comments from definitions, not fields, if applicable
- Allow embedded closed disjunctions.
- Allow nested types.
- Don't expand array element references.
Note that this removes the simplification in the openapi.cue
test: nested closed structs were not handled correctly by
this optimization.
Change-Id: Ie6adf44b37ac72139e21539094df5a728a309bd1
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5405
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/testdata/nested.cue b/encoding/openapi/testdata/nested.cue
index f1343e0..a95b2b0 100644
--- a/encoding/openapi/testdata/nested.cue
+++ b/encoding/openapi/testdata/nested.cue
@@ -4,5 +4,8 @@
T :: int
a?: T
- b?: T
+
+ {b?: T}
+
+ c?: [...T]
}