(@aws-cdk/aws-cognito): SettingAttribute 'fullname' is not consistent with documentation.
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### What is the problem?
Using aws-cognito to construct a new pool, the SettingAttribute interface is not consistent to the Cognito documentation.
The [README.md](https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-cognito/README.md) points to the cognito documentation for a list of standard attributes [user-pool-settings-attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html) which specifically has 'name' property. Configuring cognito pool in AWS console, users are also familiar with 'name' .
Yet using the ```standardAttributes: { name: {...``` this option is not available. Diggin on the code one finds the actual mapping [here](https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-cognito/lib/private/attr-names.ts) and we can see we need to use 'fullname' for 'name'. This is convoluted and not mentioned anywhere in documentation, which leads to unexpected outcomes
Note: same goes for
```
profilePicture: 'picture',
profilePage: 'profile',
timezone: 'zoneinfo', // arguably the worst offender
```
Why was this mapping created to differ from documentation? It seems odd.
I understand changing the value will now break consumers, but consider making it match Cognito documentation in future major version bump. In the meantime refer to this mapping in documentation/README.md
### Reproduction Steps
```
const pool = new cognito.UserPool(this, 'MyPool', {
userPoolName: 'CoolPool',
standardAttributes: {
name: {
required: true,
mutable: true,
},
email: {
required: true,
mutable: true,
}
},
(...)
});
```
### What did you expect to happen?
Have cognito pool with documented parameter ```name``` enabled.
### What actually happened?
Error building construct:
```
lib/cognito-pool.ts:32:9 - error TS2322: Type '{ name: { required: true; mutable: true; }; email: { required: true; mutable: true; }; }' is not assignable to type 'StandardAttributes'.
Object literal may only specify known properties, and 'name' does not exist in type 'StandardAttributes'.
32 name: {
~~~~~~~
33 required: true,
~~~~~~~~~~~~~~~~~~~~~~~~~
34 mutable: true,
~~~~~~~~~~~~~~~~~~~~~~~~
35 },
~~~~~~~~~
```
### CDK CLI Version
1.129.0
### Framework Version
_No response_
### Node.js Version
v17.0.1
### OS
MacOS
### Language
Typescript
### Language Version
TypeScript (3.9.7)
### Other information
_No response_
Contributor guide
Research direction
Start with the package README.md and the mapping in packages/@aws-cdk/aws-cognito/lib/private/attr-names.ts. Document the differing Cognito attribute names, including fullname for name, profilePicture for picture, profilePage for profile, and timezone for zoneinfo. Done means the README explains the mapping referenced by the standard attributes documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100