aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/go-openapi/spec/ref.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-openapi/spec/ref.go')
-rw-r--r--vendor/github.com/go-openapi/spec/ref.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/vendor/github.com/go-openapi/spec/ref.go b/vendor/github.com/go-openapi/spec/ref.go
index f6bfbfb56..4833b87e2 100644
--- a/vendor/github.com/go-openapi/spec/ref.go
+++ b/vendor/github.com/go-openapi/spec/ref.go
@@ -120,25 +120,18 @@ func NewRef(refURI string) (Ref, error) {
return Ref{Ref: ref}, nil
}
-// MustCreateRef creates a ref object but
+// MustCreateRef creates a ref object but panics when refURI is invalid.
+// Use the NewRef method for a version that returns an error.
func MustCreateRef(refURI string) Ref {
return Ref{Ref: jsonreference.MustCreateRef(refURI)}
}
-// // NewResolvedRef creates a resolved ref
-// func NewResolvedRef(refURI string, data interface{}) Ref {
-// return Ref{
-// Ref: jsonreference.MustCreateRef(refURI),
-// Resolved: data,
-// }
-// }
-
// MarshalJSON marshals this ref into a JSON object
func (r Ref) MarshalJSON() ([]byte, error) {
str := r.String()
if str == "" {
if r.IsRoot() {
- return []byte(`{"$ref":"#"}`), nil
+ return []byte(`{"$ref":""}`), nil
}
return []byte("{}"), nil
}