Cognito custom message request type - user attributes type change
- Dominant language
- Go
- Stars
- 3.8k
- Forks
- 578
- Avg merge
- 8h 18m
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
The `UserAttributes` field on the [`CognitoEventUserPoolsCustomMessageRequest`](https://github.com/aws/aws-lambda-go/blob/master/events/cognito.go#L254-L260) struct has the type `map[string]interface{}` instead of `map[string]string`. The [documentation](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html#cognito-user-pools-lambda-trigger-syntax-custom-message) for this event states that the values will always be strings. So is the use of `interface{}` intentional?
https://github.com/aws/aws-lambda-go/blob/b3dd246b7d83fd62856549646711e5328075c69a/events/cognito.go#L256
Leaving it as-is requires users of this package to type assert values every time they are extracted from the map which is a little inconvenient.
```go
email := event.Request.UserAttributes["email"].(string)
```
**Describe the solution you'd like**
Change the type of `UserAttributes` to `map[string]string`
Contributor guide
Assessment
This issue has not been assessed yet.