All Versions
53
Latest Version
Avg Release Cycle
6 days
Latest Release
18 days ago

Changelog History
Page 1

  • v4.32.0

    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

    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

    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

    September 30, 2020

    ๐Ÿš€ ###### This patch was authored and released by @tanner0101.

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

  • v4.29.3

    September 24, 2020

    ๐Ÿš€ ###### This patch was authored by @t-ae and released by @0xTim.

    0๏ธโƒฃ Set a cookie's default SameSite attribute to lax.

    โš  This prevents warnings in browsers and stops functionality working when following redirects, cross site link or when browsers assume the attribute to be None, which requires Secure attribute(HTTPS only).

    #2495

  • v4.29.2

    September 21, 2020

    ๐Ÿš€ ###### This patch was authored by @tanner0101 and released by @MrLotU.

    ๐Ÿ›  Fixes warnings about trailing closure matching behavior changes in Swift 5.3 (#2485, #2484).

  • v4.29.1

    August 27, 2020

    ๐Ÿš€ ###### This patch was authored by @dimitribouniol and released by @Joannis.

    ๐Ÿ›  Fixes a crash that could occur if the configuration configures a hostname address with a nil host or port, and the server is started according to the default configuration (#2479, fixes #2478).

    ๐Ÿ”ง The doc comment for HTTPServer.Configuration.address also clarifies the usage of having a nil host or port when using a .hostname-based address.

  • v4.29.0

    August 20, 2020

    ๐Ÿš€ ###### This patch was authored by @dimitribouniol and released by @MrLotU.

    โž• Adds support for Unix Domain Sockets (#2471, #2226, #2371).

    A server can be started using the serve command:

    vapor run serve --unix-socket /tmp/vapor.socket
    

    ๐Ÿ”ง Alternatively, the app can be configured in code to connect to a socket:

    app.http.server.configuration.unixDomainSocketPath = "/tmp/vapor.socket"
    

    In either scenario, if a socket path is specified, it takes precedence over binding the server to a hostname/port. Note that TLS may be combined with this options if you wish the server to only listen to encrypted connections made to the socket file.

    The socket file must not exist prior to starting the server. If one is left behind during an incomplete shutdown, however, and the app has permission to delete it, it will be overidden.

    To assist with making connections to socket paths, URI.Scheme has a .httpUnixDomainSocket property.

    try app.client.get(.init(scheme: .httpUnixDomainSocket, host: "/tmp/vapor.socket", path: "/foo"))
    
  • v4.28.0

    August 14, 2020

    ๐Ÿš€ ###### This patch was authored and released by @tanner0101.

    โž• Adds support for gracefully shutting down in-flight requests and idle keep-alive connections (#2472, fixes #2451).

    • In-flight requests will no longer respect connection: keep-alive after server shutdown is initiated.
    • Idle keep-alive connections will now be closed once server shutdown is initiated.
    • โž• Adds new HTTPHeaders helper for working with connection header.

      // Change to 'connection: close'.if req.headers.connection == .keepAlive { req.headers.connection = .close}

  • v4.27.3

    August 12, 2020

    ๐Ÿš€ ###### This patch was authored and released by @tanner0101.

    โšก๏ธ Updates to swift-nio 2.18, async-http-client 1.2, and swift-nio-http2 1.13 (#2470, #2467, fixes #2466).

    • ๐Ÿ›  Fixes any usages of deprecated methods.
    • ๐Ÿ›  Fixes a reentrancy bug causing "body stream deinit before closing" assertion that popped up in tests with latest dependencies.
    • ๐Ÿ”Š Makes trace logs from the HTTP decoder more concise.