count(_:)
Validates that the data’s count is less than the supplied upper bound using PartialRangeUpTo
.
static func count(_ range: PartialRangeUpTo<Int>) -> Validator
Validates that the data’s count is less than the supplied upper bound using PartialRangeUpTo
.
static func count(_ range: PartialRangeUpTo<Int>) -> Validator
s5Vapor9ValidatorVAASlRzrlE5countyACyxGs16PartialRangeUpToVySiGFZ
What are these?1JYM
where T:Decodable, T:Collection, T:Sendable
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
struct Validator<T> where T : Decodable, T : Sendable
@frozen struct PartialRangeUpTo<Bound> where Bound : Comparable
A partial half-open interval up to, but not including, an upper bound.
@frozen struct Int
A signed integer value type.
protocol Decodable
A type that can decode itself from an external representation.
protocol Collection<Element> : Sequence
A sequence whose elements can be traversed multiple times, nondestructively, and accessed by an indexed subscript.
protocol Sendable
static var empty: Validator<T> { get }
Validates that the data is empty. You can also check a non empty state by negating this validator: !.empty
.
static func count(_ range: ClosedRange<Int>) -> Validator<T>
Validates that the data’s count is within the supplied ClosedRange
.
static func count(_ range: Swift.Range<Int>) -> Validator<T>
Validates that the data’s count is within the supplied Range
.
static func count(_ range: PartialRangeFrom<Int>) -> Validator<T>
Validates that the data’s count is greater than or equal to the supplied lower bound using PartialRangeFrom
.
static func count(_ range: PartialRangeThrough<Int>) -> Validator<T>
Validates that the data’s count is less than or equal the supplied upper bound using PartialRangeThrough
.