encoding/openapi: bug fixes in expandReference
- indirect the reference, but avoid premature
expansion of a disjunction
- intercept infinite recursion so that a proper
error message (with location) can be given.
- allow "type" to be unspecified. This was
incorrectly assumed to be a required field.
Issue #56
Change-Id: Icc543cb626e3533305e73a0867a567c19daf8d2e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2682
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/openapi/openapi_test.go b/encoding/openapi/openapi_test.go
index 430b5d4..75e9fcc 100644
--- a/encoding/openapi/openapi_test.go
+++ b/encoding/openapi/openapi_test.go
@@ -63,6 +63,10 @@
"oneof.json",
defaultConfig,
}, {
+ "oneof.cue",
+ "oneof-resolve.json",
+ resolveRefs,
+ }, {
"openapi.cue",
"openapi.json",
defaultConfig,
@@ -107,7 +111,7 @@
t.Fatal(err)
}
- if d := diff.Diff(string(b), out.String()); d != "" {
+ if d := diff.Diff(out.String(), string(b)); d != "" {
t.Errorf("files differ:\n%v", d)
}
})