Swiftpack.co - Package - vapor/validation

Github

link
Stars: 48

Dependencies

Releases

Validation 2.1.1 - 2018-10-30 18:06:45

Fixed:

  • Improved error messages for CountValidator and RangeValidator. (#31)

Validation 1.1.2 - 2018-10-03 20:39:24

Validation 2.1.0 - 2018-08-09 01:16:37

New:

  • Added .url validator. (#28)
try validations.add(\.profilePictureURL, .url || .nil)
  • Added .empty validator. (#27)
try validations.add(\.preferedColors, !.empty)

Validation 2.0.0 - 2018-04-11 19:16:35

Validation 2.0 is here! 🎉 ✅ Extensible data validation library (name, email, etc)

Docs: https://docs.vapor.codes/3.0/validation/getting-started/

API Docs: https://api.vapor.codes/validation/latest/Validation

Milestone: 2.0.0


Changes since final release candidate:

Validation was in need of some love before the official release. The APIs have been streamlined quite a bit.

  • Validators are now accessed via leading-dot syntax instead of globally available types.
  • Validatable now requires a static function instead of a static property.
  • Validations are now generic.
  • ValidationData has been removed in favor of type-safe alternative.
  • Separate Range and Count validators.
  • New CharacterSet validator.

Here's an example of how the API looks now compared to previous release:

2.0.0

struct User: Validatable, Reflectable, Codable {
    var id: Int?
    var name: String
    var age: Int
    var email: String?

    static func validations() throws -> Validations<User> {
        var validations = Validations(User.self)
        try validations.add(\.name, .count(5...) && .alphanumeric)
        try validations.add(\.age, .range(18...))
        try validations.add(\.email, .email || .nil)
        return validations
    }
}

2.0.0-rc

struct User: Validatable, Reflectable, Codable {
    var id: Int?
    var name: String
    var age: Int
    var email: String?

    static var validations: Validations = [
        key(\.name): IsCount(5...) && IsAlphanumeric(),
        key(\.age): IsCount(18...),
        key(\.email): IsEmail() || IsNil()
    ]
}

Validation 2.0.0 RC 2.1 - 2018-03-22 20:15:30

New:

  • Use Core.Reflectable protocol.

Milestone

Validation 2.0.0 RC 2 - 2018-03-21 21:12:16

New:

  • Vapor is now running on Swift NIO!

Milestone

Validation 2.0.0 RC 1 - 2018-02-23 06:11:53

Validation 2.0.0 Beta 2 - 2018-02-22 08:08:56

New:

  • Update to latest core dependency.

Validation 2.0.0 Beta 1.1 - 2018-02-15 02:56:31

Validation 2.0.0 Beta 1 - 2018-02-13 01:20:40

Validation 1.1.1 - 2017-11-15 01:42:25

Fixed:

  • Better email validation regex.
  • Removed Swift 4 warnings.

Validation 1.1.0 - 2017-10-04 17:14:19

New:

  • Support Swift 4

Milestone

Validation 1.0.1 - 2017-05-23 21:33:36

New:

  • Some cleanup

#8

Validation 1.0 - 2017-05-22 15:43:41

🎉

Validation is a new package that carries some of the original functionality from Vapor, but simplifies quite a bit of the original concepts.

Validation 0.2.0 - 2017-04-03 08:53:11

New:

  • Bumped Debugging version.

Validation 0.1.0 - 2017-03-21 17:53:22

New:

  • Validation can be used separately from vapah