Skip to content

Commit ed33f3b

Browse files
committed
add an animated gif to the readme
1 parent 27e6f46 commit ed33f3b

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
.build
44
.swiftpm
55
samconfig.toml
6+
*key
67

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,19 @@ To expose your OpenAPI implementation as an AWS Lambda function:
5757

5858
2. Add a protocol and a constructor to your existing OpenAPI service implementation
5959

60+
![Animated GIF to show the changes](assets/swift-openapi-lambda.gif)
61+
62+
There are only four changes to make to your existing implementation:
63+
6064
```swift
6165
import Foundation
6266
import OpenAPIRuntime
63-
import OpenAPILambda // <-- add this line
67+
import OpenAPILambda // <-- 1. import this library
6468

65-
@main // <-- Flag this struct as the executable target entrypoint
66-
struct QuoteServiceImpl: APIProtocol, OpenAPILambdaHttpApi { // <-- add the OpenAPILambdaHttpApi protocol
69+
@main // <-- 2. flag this struct as the executable target entrypoint
70+
struct QuoteServiceImpl: APIProtocol, OpenAPILambdaHttpApi { // <-- 3. add the OpenAPILambdaHttpApi protocol
6771

68-
init(transport: LambdaOpenAPITransport) throws { // <-- add this constructor (don't remove the call to `registerHandlers(on:)`)
72+
init(transport: LambdaOpenAPITransport) throws { // <-- 4. add this constructor (don't remove the call to `registerHandlers(on:)`)
6973
try self.registerHandlers(on: transport)
7074
}
7175

@@ -406,7 +410,7 @@ LOCAL_LAMBDA_SERVER_ENABLED=true swift run
406410
curl -v -X POST --header "Content-Type: application/json" --data @events/GetQuote.json http://127.0.0.1:7000/invoke
407411
```
408412
409-
## Implement your own `OpenAPILambda` to support other event types
413+
## Implement your own `OpenAPILambda` to support other AWS Lambda event types
410414
411415
When you expose your AWS Lambda function to other event types, you have to specialize the `OpenAPILambda` protocol and implement the two methods that transform your Lambda function input data to an `OpenAPIRequest` and the other way around, transform an `OpenAPIResponse` to your Lambda function output type.
412416
@@ -531,4 +535,4 @@ To get started, check out [this step-by-step tutorial](https://swiftpackageindex
531535
532536
### Serverless Application Model (SAM)
533537
534-
Read "[What is SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html)" to understand and get started with SAM.
538+
Read "[What is SAM](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html)" to understand and get started with SAM.

assets/swift-openapi-lambda.gif

672 KB
Loading

0 commit comments

Comments
 (0)