Closed djrenren closed 1 year ago
Another fun cognito issue cuz this service is wack sometimes:
When cognito passes in the response field of CognitoEventUserPoolsDefineAuthChallenge, it can look like so:
response
CognitoEventUserPoolsDefineAuthChallenge
{ "challengeName": null, "failAuthentication": null, "issueTokens": null }
But the definition of CognitoEventUserPoolsDefineAuthResponse is:
CognitoEventUserPoolsDefineAuthResponse
https://github.com/calavera/aws-lambda-events/blob/9b0c65902902380c59ac267b48d502f51246c915/src/cognito/mod.rs#L308-L317
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.
Cognito
No idea either. Feel free to open a PR with suggested changes.
Another fun cognito issue cuz this service is wack sometimes:
When cognito passes in the
response
field ofCognitoEventUserPoolsDefineAuthChallenge
, it can look like so:But the definition of
CognitoEventUserPoolsDefineAuthResponse
is:https://github.com/calavera/aws-lambda-events/blob/9b0c65902902380c59ac267b48d502f51246c915/src/cognito/mod.rs#L308-L317
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:
But I'm not sure how
Cognito
handles the null values on the output. It may require them to be booleans.