func (fe *FieldError) ViaKey(key string) *FieldError {
	return fe.ViaField(asKey(key))
}
ViaKey is used to attach a key to the next ViaField provided.
For example, if a type recursively validates a parameter that has a collection:
for k, v := range spec.Bag. {
if err := doValidation(v); err != nil {
return err.ViaKey(k).ViaField("bag")
}
}
package apis
import (
	"fmt"
	"sort"
	"strings"
)
const CurrentField = ""
type FieldError struct {
	Message string
	Paths   []string
	Details string
	errors  []FieldError
}
var _ error = (*FieldError)(nil)
func (fe *FieldError) ViaField(prefix ...string) *FieldError {
	if fe == nil {
		return nil
	}
	newErr := &FieldError{
		Message: fe.Message,
		Details: fe.Details,
	}
	newPaths := make([]string, 0, len(fe.Paths))
	for _, oldPath := range fe.Paths {
		newPaths = append(newPaths, flatten(append(prefix, oldPath)))
	}
	newErr.Paths = newPaths
	for _, e := range fe.errors {
		newErr = newErr.Also(e.ViaField(prefix...))
	}
	return newErr
}
func (fe *FieldError) ViaIndex(index int) *FieldError {
	return fe.ViaField(asIndex(index))
}
func (fe *FieldError) ViaFieldIndex(field string, index int) *FieldError {
	return fe.ViaIndex(index).ViaField(field)
}