swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.13k stars 102 forks source link

Add support for AppSync events. #187

Closed DwayneCoussement closed 3 years ago

DwayneCoussement commented 3 years ago

Add support for AppSync.

Motivation:

AppSync is a common AWS Service, so it might be nice to support OOB support.

Modifications:

This is a purely additive change to support AWS AppSync. An AppSync.Request and AppSync.Response was added.

Result:

You'll be able to listen to AppSync requests as follows:

let myHandler = { (context: Lambda.Context, event: AppSync.Request, callback: (Result<AppSync.Response<MyCodableModel>, Error>) -> Void) in

}
let myHandler = { (context: Lambda.Context, event: AppSync.Request, callback: (Result<JSONStringResponse, Error>) -> Void) in

}
swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

DwayneCoussement commented 3 years ago

Thanks @DwayneCoussement for the pr and thanks @lgaches for the first round of reviews!

@DwayneCoussement would you mind running swiftformat . once on your code (please make sure you are in the project directory before you run it)? This should make the soundness check succeed.

Further I left a small number of comments. Do you know of any documentation of the AppSync Lambda Event types that we can link in the top of the file? Comparable to what we have done here:

https://github.com/swift-server/swift-aws-lambda-runtime/blob/bfdeb75e32a9720a859531b9228b4f25966a1223/Sources/AWSLambdaEvents/DynamoDB.swift#L17-L20

@lgaches also thanks for the suggestions and first code review. @fabianfett, thank you for the second review, I've applied the requested changes as well! :)

fabianfett commented 3 years ago

@swift-server-bot test this please

tomerd commented 3 years ago

@swift-server-bot test this please

tomerd commented 3 years ago

@swift-server-bot test this please

fabianfett commented 3 years ago

@swift-server-bot test this please

tomerd commented 3 years ago

@swift-server-bot test this please

fabianfett commented 3 years ago

LGTM