func (r *Ref) IsCanonical() bool {
	return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL)
}
IsCanonical returns true when this pointer starts with http(s):// or file://
package jsonreference
import (
	"errors"
	"net/url"
	"strings"
	"github.com/PuerkitoBio/purell"
	"github.com/go-openapi/jsonpointer"
)
const (
	fragmentRune = `#`
)
func New(jsonReferenceString string) (Ref, error) {
	var r Ref
	err := r.parse(jsonReferenceString)
	return r, err
}
func MustCreateRef(ref string) Ref {
	r, err := New(ref)
	if err != nil {
		panic(err)
	}
	return r
}
type Ref struct {
	referenceURL     *url.URL
	referencePointer jsonpointer.Pointer
	HasFullURL      bool
	HasURLPathOnly  bool
	HasFragmentOnly bool
	HasFileScheme   bool
	HasFullFilePath bool
}
func (r *Ref) GetURL() *url.URL {
	return r.referenceURL
}
func (r *Ref) GetPointer() *jsonpointer.Pointer {
	return &r.referencePointer
}
func (r *Ref) String() string {
	if r.referenceURL != nil {
		return r.referenceURL.String()
	}
	if r.HasFragmentOnly {
		return fragmentRune + r.referencePointer.String()
	}
	return r.referencePointer.String()
}
func (r *Ref) IsRoot() bool {
	return r.referenceURL != nil &&
		!r.IsCanonical() &&
		!r.HasURLPathOnly &&
		r.referenceURL.Fragment == ""
}