Skip to content

Releases: awslabs/swift-openapi-lambda

2.1.0

26 Oct 08:24
97b2e6d

Choose a tag to compare

This release is the first one in the repo new home (/awslabs).

We also introduce support for a new event type: Application Load Balancer (ALB). You can now expose your OpenAPI Lambda function behind an ALB. In your code, just conform to the OpenAPILambdaALB (instead of the OpenAPILambdaHttpAPI that you use for the API Gateway v2).

Look at the new example in Examples/quoteapi-alb directory.

@main
struct QuoteServiceALBImpl: APIProtocol, OpenAPILambdaALB {

    func register(transport: OpenAPILambdaTransport) throws {
        try self.registerHandlers(on: transport)
    }

    static func main() async throws {
        let openAPIService = QuoteServiceALBImpl()
        try await openAPIService.run()
    }

    // the functions generated by the OpenAPI plugin
    func getQuote(_ input: Operations.getQuote.Input) async throws -> Operations.getQuote.Output {
    ... 
    }
}

We also changed some of the legal docs (CONTRIBUTING, NOTICE, and the license headers) to match AWS's defaults.

As usual, continue to share your feedback and open issues. The full change log is below.

ALB or API Gateway?

  • ALB integrates serverless Lambdas with traditional backend targets, supporting flexible routing and basic authentication.​
  • API Gateway v2 is a managed gateway for REST, HTTP, and WebSocket APIs, offering rich features such as request validation, usage plans, custom authorizers, and integration with AWS managed services (e.g., Cognito).

My mental model to choose which one to use

  • ALB fits when integrating Lambdas into broader web applications, distributing HTTP traffic or exposing serverless functions alongside container services or EC2.​
  • API Gateway is best for building public APIs, complex microservices, or needs requiring request validation, throttling, and security integrations (OAuth, API Key, CSP).​
  • Cost: ALB is generally cheaper at scale and for high RPS traffic, while API Gateway may be more economical for low-volume APIs due to its rich feature set.​
  • API Gateway allows multiple API versions and SDK auto-generation, aiding mobile and client app backward compatibility.​
  • Latency: API Gateway introduces more overhead compared to ALB, but offers more features like transformation, validation, and direct AWS integrations.

What's Changed

SemVer Minor

  • Add support for Lambda functions exposed behind an Application Load Balancer (ALB) by @sebsto in #29

SemVer Patch

  • Change links to /swift-server to /awslabs by @sebsto in #26
  • Remove GH Action on push by @sebsto in #27
  • Adjust license files for /awslabs by @sebsto in #28

Other Changes

Full Changelog: 2.0.0...2.1.0

2.0.0

05 Oct 14:49
10f3e99

Choose a tag to compare

This library now support AWS Lambda Runtime for Swift v2.

This change affects the public API (some Sendable added) and requires a major version bump.
We release a v2 to align this library's major with the Swift AWS Lambda Runtime's major.

There is now a comprehensive example in the new Examples directory to show case

  • how to transform an existing APIProtocol to a Lambda function
  • show how to use LoggingMiddleware (optional)
  • show how to use a LambdaAuthorizer and / or an AuthenticationMiddleware (optional)
  • show how to integrate with SwiftServiceLifecycle (optional)
  • show how to deploy with sam: sam build && sam deploy

What's Changed since 2.0.0-beta.1

SemVer Minor

  • Apply recommendation for security and reliability by @sebsto in #24

Full Changelog: 0.3.0...2.0.0

2.0.0-beta.1

06 Sep 09:39
c72834d

Choose a tag to compare

2.0.0-beta.1 Pre-release
Pre-release

This library now support the upcoming release of AWS Lambda Runtime for Swift v2.

This change affects the public API (some Sendable added) and requires a major version bump.
we release a v2 to align this library's major with the Swift AWS Lambda Runtime's major.

There is now a comprehensive example in the new Examples directory to show case

  • how to transform an existing APIProtocol to a Lambda function
  • show how to use LoggingMiddleware (optional)
  • show how to use a LambdaAuthorizer and / or an AuthenticationMiddleware (optional)
  • show how to integrate with SwiftServiceLifecycle (optional)
  • show how to deploy with sam: sam build && sam deploy

What's Changed

SemVer Major

  • Update to support AWS Lambda Runtime for Swift v2 by @sebsto in #22

Full Changelog: 0.3.0...2.0.0-beta.1

0.3.0

30 Aug 20:36
6a54484

Choose a tag to compare

What's Changed

In preparation of the v2 (aligned to Swift AWS Lambda Runtime), we're adding a QuoteAPI example.

SemVer Minor

Full Changelog: 0.2.1...0.3.0

0.2.1

13 Jun 16:26
78dcf0c

Choose a tag to compare

What's Changed

SemVer Patch

Other Changes

New Contributors

Full Changelog: 0.2.0...0.2.1

0.2.0

30 Oct 17:25
eec0a05

Choose a tag to compare

🚨 Add support for query string parameters (thank you @emlynmu for the contribution)

What's Changed

  • migrate to swift-test by @sebsto in #9
  • use SwiftLang's license header check by @sebsto in #10
  • Fix Query String Parameters Being Ignored by @emlynmu in #11

New Contributors

Full Changelog: 0.1.2...0.2.0

0.1.2

23 May 09:02

Choose a tag to compare

Update dependency

Swift Lambda Events -> 0.3.0 (with a breaking change on HTTP Types)