Cognito passes in explicitly null booleans for DefineAuth responses
djrenren opened this issue · comments
Another fun cognito issue cuz this service is wack sometimes:
When cognito passes in the response
field of CognitoEventUserPoolsDefineAuthChallenge
, it can look like so:
{
"challengeName": null,
"failAuthentication": null,
"issueTokens": null
}
But the definition of CognitoEventUserPoolsDefineAuthResponse
is:
aws-lambda-events/src/cognito/mod.rs
Lines 308 to 317 in 9b0c659
Serde does not use the default implementation if a value is explicitly set to null. It only uses default if the value is excluded. This results in a failure to deserialize. I'm currently working around this by using my own type defined with:
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DefineAuthResponse{
#[serde(default)]
pub challenge_name: Option<String>,
#[serde(default)]
pub issue_tokens: Option<bool>,
#[serde(default)]
pub fail_authentication: Option<bool>,
}
But I'm not sure how Cognito
handles the null values on the output. It may require them to be booleans.
But I'm not sure how
Cognito
handles the null values on the output. It may require them to be booleans.
No idea either. Feel free to open a PR with suggested changes.