{"modulePath":"github.com/UnityTech/client-go","version":"v2.0.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package field\n\n## Functions\n\n```go\nfunc NewErrorTypeMatcher(t ErrorType) utilerrors.Matcher\n```\nNewErrorTypeMatcher returns an errors.Matcher that returns true if the provided error is a Error and has the provided ErrorType.\n\n## Types\n\n```go\ntype Error struct {\n\tType     ErrorType\n\tField    string\n\tBadValue interface{}\n\tDetail   string\n}\n```\nError is an implementation of the 'error' interface, which represents a field-level validation error.\n\n```go\nfunc Duplicate(field *Path, value interface{}) *Error\n```\nDuplicate returns a \\*Error indicating \"duplicate value\".  This is used to report collisions of values that must be unique (e.g. names or IDs).\n\n```go\nfunc Forbidden(field *Path, detail string) *Error\n```\nForbidden returns a \\*Error indicating \"forbidden\".  This is used to report valid (as per formatting rules) values which would be accepted under some conditions, but which are not permitted by current conditions (e.g. security policy).\n\n```go\nfunc InternalError(field *Path, err error) *Error\n```\nInternalError returns a \\*Error indicating \"internal error\".  This is used to signal that an error was found that was not directly related to user input.  The err argument must be non-nil.\n\n```go\nfunc Invalid(field *Path, value interface{}, detail string) *Error\n```\nInvalid returns a \\*Error indicating \"invalid value\".  This is used to report malformed values (e.g. failed regex match, too long, out of bounds).\n\n```go\nfunc NotFound(field *Path, value interface{}) *Error\n```\nNotFound returns a \\*Error indicating \"value not found\".  This is used to report failure to find a requested value (e.g. looking up an ID).\n\n```go\nfunc NotSupported(field *Path, value interface{}, validValues []string) *Error\n```\nNotSupported returns a \\*Error indicating \"unsupported value\". This is used to report unknown values for enumerated fields (e.g. a list of valid values).\n\n```go\nfunc Required(field *Path, detail string) *Error\n```\nRequired returns a \\*Error indicating \"value required\".  This is used to report required values that are not provided (e.g. empty strings, null values, or empty arrays).\n\n```go\nfunc TooLong(field *Path, value interface{}, maxLength int) *Error\n```\nTooLong returns a \\*Error indicating \"too long\".  This is used to report that the given value is too long.  This is similar to Invalid, but the returned error will not include the too-long value.\n\n```go\nfunc (v *Error) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (v *Error) ErrorBody() string\n```\nErrorBody returns the error message without the field name.  This is useful for building nice-looking higher-level error reporting.\n\n```go\ntype ErrorList []*Error\n```\nErrorList holds a set of Errors.  It is plausible that we might one day have non-field errors in this same umbrella package, but for now we don't, so we can keep it simple and leave ErrorList here.\n\n```go\nfunc (list ErrorList) Filter(fns ...utilerrors.Matcher) ErrorList\n```\nFilter removes items from the ErrorList that match the provided fns.\n\n```go\nfunc (list ErrorList) ToAggregate() utilerrors.Aggregate\n```\nToAggregate converts the ErrorList into an errors.Aggregate.\n\n```go\ntype ErrorType string\n```\nErrorType is a machine readable value providing more detail about why a field is invalid.  These values are expected to match 1-1 with CauseType in api/types.go.\n\n```go\nconst (\n\t// ErrorTypeNotFound is used to report failure to find a requested value\n\t// (e.g. looking up an ID).  See NotFound().\n\tErrorTypeNotFound ErrorType = \"FieldValueNotFound\"\n\t// ErrorTypeRequired is used to report required values that are not\n\t// provided (e.g. empty strings, null values, or empty arrays).  See\n\t// Required().\n\tErrorTypeRequired ErrorType = \"FieldValueRequired\"\n\t// ErrorTypeDuplicate is used to report collisions of values that must be\n\t// unique (e.g. unique IDs).  See Duplicate().\n\tErrorTypeDuplicate ErrorType = \"FieldValueDuplicate\"\n\t// ErrorTypeInvalid is used to report malformed values (e.g. failed regex\n\t// match, too long, out of bounds).  See Invalid().\n\tErrorTypeInvalid ErrorType = \"FieldValueInvalid\"\n\t// ErrorTypeNotSupported is used to report unknown values for enumerated\n\t// fields (e.g. a list of valid values).  See NotSupported().\n\tErrorTypeNotSupported ErrorType = \"FieldValueNotSupported\"\n\t// ErrorTypeForbidden is used to report valid (as per formatting rules)\n\t// values which would be accepted under some conditions, but which are not\n\t// permitted by the current conditions (such as security policy).  See\n\t// Forbidden().\n\tErrorTypeForbidden ErrorType = \"FieldValueForbidden\"\n\t// ErrorTypeTooLong is used to report that the given value is too long.\n\t// This is similar to ErrorTypeInvalid, but the error will not include the\n\t// too-long value.  See TooLong().\n\tErrorTypeTooLong ErrorType = \"FieldValueTooLong\"\n\t// ErrorTypeInternal is used to report other errors that are not related\n\t// to user input.  See InternalError().\n\tErrorTypeInternal ErrorType = \"InternalError\"\n)\n```\nTODO: These values are duplicated in api/types.go, but there's a circular dep.  Fix it.\n\n```go\nfunc (t ErrorType) String() string\n```\nString converts a ErrorType into its corresponding canonical error message.\n\n```go\ntype Path struct {\n\t// contains filtered or unexported fields\n}\n```\nPath represents the path from some root to a particular field.\n\n```go\nfunc NewPath(name string, moreNames ...string) *Path\n```\nNewPath creates a root Path object.\n\n```go\nfunc (p *Path) Child(name string, moreNames ...string) *Path\n```\nChild creates a new Path that is a child of the method receiver.\n\n```go\nfunc (p *Path) Index(index int) *Path\n```\nIndex indicates that the previous Path is to be subscripted by an int. This sets the same underlying value as Key.\n\n```go\nfunc (p *Path) Key(key string) *Path\n```\nKey indicates that the previous Path is to be subscripted by a string. This sets the same underlying value as Index.\n\n```go\nfunc (p *Path) Root() *Path\n```\nRoot returns the root element of this Path.\n\n```go\nfunc (p *Path) String() string\n```\nString produces a string representation of the Path.\n\n","path":"github.com/UnityTech/client-go/pkg/util/validation/field","name":"field","synopsis":"","isRedistributable":true}
