From 7d3363b3723c564d0d1ed23279413e6e7fcb53f2 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Sat, 12 Nov 2022 15:04:46 -0800 Subject: [PATCH 1/2] Fix Cognito's serialization format Signed-off-by: David Calavera --- lambda-runtime/src/types.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lambda-runtime/src/types.rs b/lambda-runtime/src/types.rs index 17eb312b..527070b5 100644 --- a/lambda-runtime/src/types.rs +++ b/lambda-runtime/src/types.rs @@ -70,10 +70,13 @@ pub struct ClientApplication { /// Cognito identity information sent with the event #[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +#[serde(rename_all = "camelCase")] pub struct CognitoIdentity { /// The unique identity id for the Cognito credentials invoking the function. + #[serde(alias = "cognitoIdentityId")] pub identity_id: String, /// The identity pool id the caller is "registered" with. + #[serde(alias = "cognitoIdentityPoolId")] pub identity_pool_id: String, } From 2c699475a0d94fc8d69dd7a8645e097fb502b049 Mon Sep 17 00:00:00 2001 From: David Calavera Date: Sat, 12 Nov 2022 15:18:06 -0800 Subject: [PATCH 2/2] Fix Identity and Client metadata Signed-off-by: David Calavera --- lambda-runtime/src/types.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lambda-runtime/src/types.rs b/lambda-runtime/src/types.rs index 527070b5..1cfab2fc 100644 --- a/lambda-runtime/src/types.rs +++ b/lambda-runtime/src/types.rs @@ -57,14 +57,19 @@ pub struct ClientContext { #[serde(rename_all = "camelCase")] pub struct ClientApplication { /// The mobile app installation id + #[serde(alias = "installation_id")] pub installation_id: String, /// The app title for the mobile app as registered with AWS' mobile services. + #[serde(alias = "app_title")] pub app_title: String, /// The version name of the application as registered with AWS' mobile services. + #[serde(alias = "app_version_name")] pub app_version_name: String, /// The app version code. + #[serde(alias = "app_version_code")] pub app_version_code: String, /// The package name for the mobile application invoking the function + #[serde(alias = "app_package_name")] pub app_package_name: String, } @@ -73,10 +78,10 @@ pub struct ClientApplication { #[serde(rename_all = "camelCase")] pub struct CognitoIdentity { /// The unique identity id for the Cognito credentials invoking the function. - #[serde(alias = "cognitoIdentityId")] + #[serde(alias = "cognitoIdentityId", alias = "identity_id")] pub identity_id: String, /// The identity pool id the caller is "registered" with. - #[serde(alias = "cognitoIdentityPoolId")] + #[serde(alias = "cognitoIdentityPoolId", alias = "identity_pool_id")] pub identity_pool_id: String, }