encoding/openapi: allow empty string from ReferenceFunc

When users use ReferenceFunc, it may be hard to
map certain types, like CUE builtin types, to the custom
namespace. Returning "" now allows such references
to be expanded in place. In the case of CUE builtin types,
the represented type will be that of the underlying type
(usually a string).

Change-Id: I27b5bd749f2c5339a2e5381376333e77424ee682
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2760
Reviewed-by: Jason Wang <jasonwzm@google.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/openapi_test.go b/encoding/openapi/openapi_test.go
index bcdaf19..1459527 100644
--- a/encoding/openapi/openapi_test.go
+++ b/encoding/openapi/openapi_test.go
@@ -94,6 +94,19 @@
 				return "Randomly picked description from a set of size one."
 			},
 		},
+	}, {
+		"refs.cue",
+		"refs.json",
+		&Generator{
+			Info: info,
+			ReferenceFunc: func(inst *cue.Instance, path []string) string {
+				switch {
+				case strings.HasPrefix(path[0], "Excluded"):
+					return ""
+				}
+				return strings.Join(path, ".")
+			},
+		},
 	}}
 	for _, tc := range testCases {
 		t.Run(tc.out, func(t *testing.T) {