func (r *Resolver) Resolve(v interface{}, ptr string, options ...Option) (ret interface{}, err error) {
	if pdebug.Enabled {
		g := pdebug.Marker("Resolver.Resolve(%s)", ptr).BindError(&err)
		defer g.End()
	}
	var recursiveResolution bool
	for _, opt := range options {
		switch opt.Name() {
		case "recursiveResolution":
			recursiveResolution = opt.Value().(bool)
		}
	}
	ctx := resolveCtx{
		rlevel:    0,
		maxrlevel: r.MaxRecursions,
		object:    v,
	}
	v, err = expandRefRecursive(&ctx, r, v)
	if err != nil {
		return nil, errors.Wrap(err, "recursive search failed")
	}
	result, err := evalptr(&ctx, r, v, ptr)
	if err != nil {
		return nil, err
	}
	if recursiveResolution {
		rv, err := traverseExpandRefRecursive(&ctx, r, reflect.ValueOf(result))
		if err != nil {
			return nil, errors.Wrap(err, `failed to resolve result`)
		}
		result = rv.Interface()
	}
	return result, nil
}
Resolve takes a target `v`, and a JSON pointer `spec`.
spec is expected to be in the form of

[scheme://[userinfo@]host/path[?query]]#fragment
[scheme:opaque[?query]]#fragment

where everything except for `#fragment` is optional.
If the fragment is empty, an error is returned.

If `spec` is the empty string, `v` is returned
This method handles recursive JSON references.

If `WithRecursiveResolution` option is given and its value is true,
an attempt to resolve all references within the resulting object
is made by traversing the structure recursively. Default is false
package jsref
import (
	"net/url"
	"reflect"
	"github.com/lestrrat/go-jspointer"
	"github.com/lestrrat/go-pdebug"
	"github.com/lestrrat/go-structinfo"
	"github.com/pkg/errors"
)
const ref = "$ref"
var refrv = reflect.ValueOf(ref)
type Option interface {
	Name() string
	Value() interface{}
}
type option struct {
	name  string
	value interface{}
}
func (o option) Name() string       { return o.name }
func (o option) Value() interface{} { return o.value }
func WithRecursiveResolution(b bool) Option {
	return &option{
		name:  "recursiveResolution",
		value: b,
	}
}
var DefaultMaxRecursions = 10
func New() *Resolver {
	return &Resolver{MaxRecursions: DefaultMaxRecursions}
}
func (r *Resolver) AddProvider(p Provider) error {
	r.providers = append(r.providers, p)
	return nil
}
type resolveCtx struct {
	rlevel    int          
	maxrlevel int          
	object    interface{}  
}