encoding/openapi: add support for deprecated field from protobuf
protos may be marked as `deprecated=true` in their definitions,
these fields can be mapped to openapi field `deprecated`.
Change-Id: I41204b1cd7e32e2822145622c6dfeab5d8184d65
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2900
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/types.go b/encoding/openapi/types.go
index d46fd2b..209dda6 100644
--- a/encoding/openapi/types.go
+++ b/encoding/openapi/types.go
@@ -62,6 +62,13 @@
return cueToOpenAPI[s]
}
+func getDeprecated(v cue.Value) bool {
+ // only looking at protobuf attribute for now.
+ a := v.Attribute("protobuf")
+ r, _ := a.Flag(1, "deprecated")
+ return r
+}
+
func simplify(b *builder, t *OrderedMap) {
if b.format == "" {
return