func (f FieldMismatch) String() string {
	return f.MessageWithField()
}
String returns a user friendly message explaining the type mismatch.
package schema
import (
	"fmt"
	"math"
	"reflect"
	"strings"
)
type CompareResults struct {
	MismatchedFields []FieldMismatch
	MissingFields []FieldMissing
}
func (cr *CompareResults) Errors() error {
	if len(cr.MismatchedFields) == 0 {
		return nil
	}
	m := make(map[string]interface{})
	for _, f := range cr.MismatchedFields {
		cursor := m
		for _, path := range f.Path {
			if _, ok := cursor[path]; !ok {
				cursor[path] = make(map[string]interface{})
			}
			cursor = cursor[path].(map[string]interface{})
		}
		cursor[f.Field] = f.Message()
	}
	return MismatchError(m)
}
type FieldMissing struct {
	Field string
	Path []string
}
func (f FieldMissing) String() string {
	return FieldNameWithPath(f.Field, f.Path)
}
type FieldMismatch struct {
	Field string
	Expected string
	Actual string
	Path []string
}
func (f FieldMismatch) Message() string {
	return fmt.Sprintf(
		`expected %s but it's %s`,
		TypeNameWithArticle(f.Expected),
		TypeNameWithArticle(f.Actual),
	)
}
// Message returns the field mismatch error as a string, and includes the field name
// with its path in the message.
// e.g: "expected Cat.Foo to be an int but it's a string"
func (f FieldMismatch) MessageWithField() string {
	return fmt.Sprintf(
		`expected "%s" to be %s but it's %s`,
		FieldNameWithPath(f.Field, f.Path),
		TypeNameWithArticle(f.Expected),
		TypeNameWithArticle(f.Actual),
	)
}