LengthValidation
public protocol LengthValidation: Validation where Supported: Collection
A validation type that verifies the length of a type conforming to Collection
.
internal struct LengthRange10To1028<C>: LengthValidation where C: Collection {
typealias Supported = C
static var maxLength: Int { return 1028 }
static var minLength: Int { return 10 }
}
If the value passed into the validate
method has a length the is greater than maxLength
, ValidationError.lengthTooLong
is thrown.
If the value has a length less than minLength
, ValidationError.lengthTooShort
is thrown.