Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBodyRequired = errors.New("body required")
ErrBodyRequired reports that request body is required but server got empty request.
var ErrFieldRequired = errors.New("field required")
ErrFieldRequired reports that field is required, but not found.
Functions ¶
func InvalidContentType ¶ added in v0.11.1
InvalidContentType creates new InvalidContentTypeError.
func UnexpectedStatusCode ¶ added in v0.11.1
UnexpectedStatusCode creates new UnexpectedStatusCode.
Types ¶
type Array ¶
Array validates array length.
func (*Array) SetMaxLength ¶
SetMaxLength sets MaxLength validation.
func (*Array) SetMinLength ¶
SetMinLength sets MinLength validation.
func (Array) ValidateLength ¶
ValidateLength returns error if array length v is invalid.
type FieldError ¶
FieldError is failed validation on field.
type Int ¶
type Int struct { MultipleOf int MultipleOfSet bool Min int64 MinSet bool MinExclusive bool Max int64 MaxSet bool MaxExclusive bool }
Int validates integers.
func (*Int) SetExclusiveMaximum ¶
SetExclusiveMaximum sets exclusive maximum value.
func (*Int) SetExclusiveMinimum ¶
SetExclusiveMinimum sets exclusive minimum value.
func (*Int) SetMultipleOf ¶
SetMultipleOf sets multipleOf validator.
type InvalidContentTypeError ¶ added in v0.11.1
type InvalidContentTypeError struct {
ContentType string
}
InvalidContentTypeError reports that decoder got unexpected content type.
func (*InvalidContentTypeError) Error ¶ added in v0.11.1
func (i *InvalidContentTypeError) Error() string
InvalidContentTypeError implements error.
type Object ¶ added in v0.12.0
type Object struct { MinProperties int MinPropertiesSet bool MaxProperties int MaxPropertiesSet bool }
Object validates map length.
func (*Object) SetMaxProperties ¶ added in v0.12.0
SetMaxProperties sets MaxProperties validation.
func (*Object) SetMinProperties ¶ added in v0.12.0
SetMinProperties sets MinProperties validation.
func (Object) ValidateProperties ¶ added in v0.12.0
ValidateProperties returns error if object length (properties number) v is invalid.
type String ¶
type String struct { MinLength int MinLengthSet bool MaxLength int MaxLengthSet bool Email bool Regex *regexp.Regexp Hostname bool }
String validator.
func (*String) SetMaxLength ¶
SetMaxLength sets maximum string length (in Unicode code points).
func (*String) SetMinLength ¶
SetMinLength sets minimum string length (in Unicode code points).
type UnexpectedStatusCodeError ¶ added in v0.11.1
type UnexpectedStatusCodeError struct {
StatusCode int
}
UnexpectedStatusCodeError reports that client got unexpected status code.
func (*UnexpectedStatusCodeError) Error ¶ added in v0.11.1
func (i *UnexpectedStatusCodeError) Error() string
UnexpectedStatusCodeError implements error.