From 0c26b7f088662bdace3cfeb00524d9ecd75fe2ad Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Fri, 7 Mar 2025 09:37:32 +0100 Subject: [PATCH 1/2] Remove unnecessary handler constraints --- Sources/AWSLambdaRuntime/Lambda+Codable.swift | 2 +- Sources/AWSLambdaRuntime/LambdaHandlers.swift | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/AWSLambdaRuntime/Lambda+Codable.swift b/Sources/AWSLambdaRuntime/Lambda+Codable.swift index a77c0542..e22f31cb 100644 --- a/Sources/AWSLambdaRuntime/Lambda+Codable.swift +++ b/Sources/AWSLambdaRuntime/Lambda+Codable.swift @@ -116,7 +116,7 @@ public struct LambdaCodableAdapter< } /// A ``StreamingLambdaHandler/handle(_:responseWriter:context:)`` wrapper. - /// - Parameters: + /// - Parameters: /// - event: The received event. /// - outputWriter: The writer to write the computed response to. /// - context: The ``LambdaContext`` containing the invocation's metadata. diff --git a/Sources/AWSLambdaRuntime/LambdaHandlers.swift b/Sources/AWSLambdaRuntime/LambdaHandlers.swift index 82a6eef3..d6e0b373 100644 --- a/Sources/AWSLambdaRuntime/LambdaHandlers.swift +++ b/Sources/AWSLambdaRuntime/LambdaHandlers.swift @@ -67,7 +67,7 @@ public protocol LambdaResponseStreamWriter { public protocol LambdaHandler { /// Generic input type. /// The body of the request sent to Lambda will be decoded into this type for the handler to consume. - associatedtype Event: Decodable + associatedtype Event /// Generic output type. /// This is the return type of the ``LambdaHandler/handle(_:context:)`` function. associatedtype Output @@ -89,7 +89,7 @@ public protocol LambdaHandler { public protocol LambdaWithBackgroundProcessingHandler { /// Generic input type. /// The body of the request sent to Lambda will be decoded into this type for the handler to consume. - associatedtype Event: Decodable + associatedtype Event /// Generic output type. /// This is the type that the `handle` function will send through the ``LambdaResponseWriter``. associatedtype Output @@ -183,9 +183,10 @@ extension LambdaRuntime { } /// Initialize an instance with a ``LambdaHandler`` defined in the form of a closure **with a non-`Void` return type**, an encoder, and a decoder. - /// - Parameter body: The handler in the form of a closure. - /// - Parameter encoder: The encoder object that will be used to encode the generic `Output` into a `ByteBuffer`. - /// - Parameter decoder: The decoder object that will be used to decode the incoming `ByteBuffer` event into the generic `Event` type. + /// - Parameters: + /// - encoder: The encoder object that will be used to encode the generic `Output` into a `ByteBuffer`. + /// - decoder: The decoder object that will be used to decode the incoming `ByteBuffer` event into the generic `Event` type. + /// - body: The handler in the form of a closure. public convenience init< Event: Decodable, Output: Encodable, From a738a7ae5f12bb11ec54aa1d890405932160b95e Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Fri, 7 Mar 2025 10:18:06 +0100 Subject: [PATCH 2/2] Fix docs --- Sources/AWSLambdaRuntime/Lambda+Codable.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/AWSLambdaRuntime/Lambda+Codable.swift b/Sources/AWSLambdaRuntime/Lambda+Codable.swift index e22f31cb..abc8728b 100644 --- a/Sources/AWSLambdaRuntime/Lambda+Codable.swift +++ b/Sources/AWSLambdaRuntime/Lambda+Codable.swift @@ -117,8 +117,8 @@ public struct LambdaCodableAdapter< /// A ``StreamingLambdaHandler/handle(_:responseWriter:context:)`` wrapper. /// - Parameters: - /// - event: The received event. - /// - outputWriter: The writer to write the computed response to. + /// - request: The received event. + /// - responseWriter: The writer to write the computed response to. /// - context: The ``LambdaContext`` containing the invocation's metadata. @inlinable public mutating func handle(