-
Notifications
You must be signed in to change notification settings - Fork 115
Use a struct for ClientContext (fix #169) #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the string-based ClientContext
implementation with strongly-typed structs to provide better type safety and compiler error detection for AWS Lambda runtime client context data.
- Replaces
String?
type with structuredClientContext
andClientApplication
types - Adds proper JSON encoding/decoding with snake_case field mapping for AWS compatibility
- Includes comprehensive unit tests covering various ClientContext scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
Sources/AWSLambdaRuntime/LambdaContext.swift | Introduces ClientContext and ClientApplication structs with proper Codable implementation and updates LambdaContext to use the new types |
Tests/AWSLambdaRuntimeTests/LambdaContextTests.swift | Adds comprehensive test suite covering JSON encoding/decoding scenarios for the new ClientContext types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thank you for addressing this, it's been a while huh!
Co-authored-by: Konrad `ktoso` Malawski <[email protected]>
Do not use a String for Lambdacontext.ClientContext, use a struct instead
fix for #169
Note: this PR introduces an API change that will break function using
LambdaContext
, we should integrate this change during the beta otherwise it will require a major version bump.Motivation:
Let the compiler detect type errors for us
Modifications:
Result:
No more String?