All Versions
59
Latest Version
Avg Release Cycle
6 days
Latest Release
324 days ago

Changelog History
Page 1

  • v4.36.0 Changes

    November 27, 2020

    🚀 ###### This patch was authored and released by @Mordil.

    As reported by #2480, right now SessionData is a public type without much use to developers to write middleware, algorithms, etc. on top of due to how strongly the storage is encapsulated.

    SessionData has been changed as follows:

    • Now conforms to Equatable and ExpressibleByDictionaryLiteral
    • A new snapshot computed property is available to get a copy of its storage
    • 🗄 init(_:) is now deprecated in favor of init(initialData:)

      let data: SessionData = ["name": "Vapor"]// creates a copy of the data as of this pointlet snapshot = data.snapshotclient.storeUsingDictionary(snapshot)

  • v4.35.0 Changes

    November 03, 2020

    🚀 ###### This patch was authored and released by @gwynne.

    🌲 Previously, all requests received by Vapor would always be logged unconditionally at the .info log level, with no means available to control or disable it.

    🚚 This logging has been moved to an enabled-by-default middleware. Users can remove the RouteLoggingMiddleware from Application.middleware to prevent any route logging from taking place.

  • v4.34.1 Changes

    November 02, 2020

    🚀 ###### This patch was authored by @andtie and released by @0xTim.

    🔧 Honor the configuration for Date Decoding & Encoding in URLEncodedFormDecoder / URLEncodedFormEncoder (fixes #2518).

    // Configure a non-default date decoding strategylet decoder = URLEncodedFormDecoder(configuration: .init(dateDecodingStrategy: .iso8601)) ContentConfiguration.global.use(urlDecoder: decoder)// allow to use optional date-parameters in a request let after = try req.query.get(Date?.self, at: "after") ?? .distantPast// =\> dates with the expected format (e.g. "...?after=2020-10-28T10:31:14Z") are correctly parsed
    
  • v4.34.0 Changes

    October 27, 2020

    🚀 ###### This patch was authored and released by @siemensikkema.

    • Prevents a separate EventLoopGroup from being created unnecessarily for loading .env files.
    • 🗄 Deprecates overloads for DotEnvFile.load in favor of version that accept a NonBlockingFileIO so existing resources can be reused.
    • Prevents multiple EventLoopGroups from being created when calling the load methods that take an Environment when provided without a shared EventLoopGroupProvider.
  • v4.33.0 Changes

    October 27, 2020

    🚀 ###### This patch was authored by @code28 and released by @siemensikkema.

    ➕ Adds support for a custom implementation of shouldUpgrade for websockets. This can be used to switch to specific subprotocols or to deny upgrading by returning nil.

    routes.webSocket("authedecho", shouldUpgrade: { req inguard req.auth.has(User.self) else { return req.eventLoop.future(nil) } return req.eventLoop.future([:]) }, onUpgrade: { req, ws inprint(ws) })
    
  • v4.32.1 Changes

    October 26, 2020

    🚀 ###### This patch was authored by @bridger and released by @siemensikkema.

    Forward the arguments passed to DotEnvFile.load(for:on:logger) to DotEnvFile.load(path:on:logger).

    0️⃣ This ensures that the passed in EventLoopGroupProvider and Logger actually get used instead of default ones.

  • v4.32.0 Changes

    October 07, 2020

    🚀 ###### This patch was authored and released by @tanner0101.

    ➕ Adds support for validating nested arrays (#2473, #2238, fixes #2158).

    Assuming the following User definition:

    struct User: Codable { struct Hobby: Codable { var title: String } var hobbies: [Hobby] }
    

    Validations for User and its nested array of hobbies can be defined like so:

    extension User: Validatable { static func validations(\_ validations: inout Validations) { validations.add(each: "hobbies") { i, hobby in hobby.add("title", as: String.self, is: .characterSet(.alphanumerics + .whitespaces)) } } }
    

    Note that the closure receives the items index i. This can be used to dynamically adjust validations depending on index:

    validations.add(each: "hobbies") { i, hobby in// Don't validate first item.if i != 0 { hobby.add("title", as: String.self, is: .characterSet(.alphanumerics + .whitespaces)) } }
    

    Also note how this method complements Validations.add(_:) (without the each parameter) for validating nested dictionaries:

    struct User: Codable, Validatable { struct Hobby: Codable { var title: String } var hobby: Hobby static func validations(\_ validations: inout Validations) { validations.add("hobbies") { hobby in hobby.add("title", as: String.self, is: .characterSet(.alphanumerics + .whitespaces)) } } }
    
  • v4.31.0 Changes

    October 03, 2020

    🚀 ###### This patch was authored by @Craz1k0ek and released by @MrLotU.

    ➕ Adds HOTP & TOTP support. (#2499)

    The HOTP can be created as an object, or it can be statically generated once:

    let key = SymmetricKey(size: .bits128)let code = HOTP(key: key, digest: .sha1, digits: .six).generate(counter: 15) HOTP.generate(key: key, digest: .sha1, digits: .six, counter: 15)
    

    The TOTP can be created as an object, or it can be statically generated once:

    let key = SymmetricKey(size: .bits128)let code = TOTP(key: key, digest: .sha1, digits: .six, interval: 30).generate(time: Date()) TOTP.generate(key: key, digest: .sha1, digits: .six, interval: 30, time: Date())
    
  • v4.30.0 Changes

    October 01, 2020

    🚀 ###### This patch was authored and released by @JaapWijnen.

    • DotEnv files can be loaded before initializing application
    • ⬇️ Reduces boilerplate code when you want to bootstrap logging with environment variables loaded from a .env file
    • Can be loaded in similar fashion as Application or provide absolute and relative .env file locations using DotEnvFile.load(path: ...)

      let env = try Environment.detect() DotEnvFile.load(for: env) LoggingSystem.bootstrap { label in// use environment variables here (before application is initialized)}let app = Application(env)

  • v4.29.4 Changes

    September 30, 2020

    🚀 ###### This patch was authored and released by @tanner0101.

    🛠 Fixes an issue preventing FileMiddleware from detecting relative paths when percent encoded (#2500).