Releases: awslabs/swift-openapi-lambda
2.1.0
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
- Fix a typo in the README by @sebsto in #25
- Update CI by @sebsto in #30
- Change Swift workflow to Ubuntu and simplify triggers by @sebsto in #31
- Change Build Badge by @sebsto in #32
Full Changelog: 2.0.0...2.1.0
2.0.0
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
APIProtocolto a Lambda function - show how to use
LoggingMiddleware(optional) - show how to use a
LambdaAuthorizerand / or anAuthenticationMiddleware(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
Full Changelog: 0.3.0...2.0.0
2.0.0-beta.1
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
APIProtocolto a Lambda function - show how to use
LoggingMiddleware(optional) - show how to use a
LambdaAuthorizerand / or anAuthenticationMiddleware(optional) - show how to integrate with
SwiftServiceLifecycle(optional) - show how to deploy with
sam:sam build && sam deploy
What's Changed
SemVer Major
Full Changelog: 0.3.0...2.0.0-beta.1
0.3.0
0.2.1
What's Changed
SemVer Patch
Other Changes
- fix badge by @sebsto in #15
- Update release.yml by @FranzBusch in #17
New Contributors
- @FranzBusch made their first contribution in #13
- @heyzooi made their first contribution in #19
Full Changelog: 0.2.0...0.2.1
0.2.0
🚨 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