func InMemoryLoader() RegistryLoader {
	return LocalRegistryLoader(localRegistryPath, true  )
}
InMemoryLoader returns a loader which points tothe local cache registry.
package validator
import (
	"fmt"
	"strings"
	"github.com/santhosh-tekuri/jsonschema"
)
type DescriptorValidator interface {
	Validate(map[string]interface{}) error
}
const localRegistryPath = "/registry.json"
const remoteRegistryURL = "http://frictionlessdata.io/schemas/registry.json"
func NewRegistry(loaders ...RegistryLoader) (Registry, error) {
	if len(loaders) == 0 {
		loaders = append(
			loaders,
			InMemoryLoader(),
			LocalRegistryLoader(localRegistryPath, false  ),
			RemoteRegistryLoader(remoteRegistryURL))
	}
	registry, err := FallbackRegistryLoader(loaders...)()
	if err != nil {
		return nil, fmt.Errorf("could not load registry:%q", err)
	}
	return registry, nil
}
func New(profile string, loaders ...RegistryLoader) (DescriptorValidator, error) {
	if strings.HasPrefix(profile, "http") || strings.HasPrefix(profile, "file") {
		schema, err := jsonschema.Compile(profile)
		if err != nil {
			return nil, err
		}
		return &jsonSchema{schema: schema}, nil
	}
	registry, err := NewRegistry(loaders...)
	if err != nil {
		return nil, err
	}
	return registry.GetValidator(profile)
}
func Validate(descriptor map[string]interface{}, profile string, registry Registry) error {
	validator, err := registry.GetValidator(profile)
	if err != nil {
		return fmt.Errorf("Invalid Schema (Profile:%s):%q", profile, err)
	}
	return validator.Validate(descriptor)
}
func MustInMemoryRegistry() Registry {
	reg, err := InMemoryLoader()()
	if err != nil {
		panic(err)
	}
	return reg
}