feat(cognito): include all standard attributes in DescribeUserPool Schema (#642)

* feat(cognito): include all standard attributes in DescribeUserPool SchemaAttributes

AWS Cognito always returns all 20 standard OIDC attributes (sub, name,
email, phone_number, etc.) in SchemaAttributes when describing a user
pool, even if none were explicitly configured. Floci was returning only
what was passed in Schema during creation.

Adds CognitoStandardAttributes with the full default set and a merge()
helper that overlays explicit schema overrides and appends custom:
attributes after the standard ones.

* test(cognito): add compat tests for standard SchemaAttributes across all SDKs

Adds DescribeUserPool SchemaAttributes coverage to all compatibility test
suites (AWS CLI/bats, Go, Java, Node, Python, Rust), verifying that all
20 standard OIDC attributes are returned and that sub is required and
immutable.
This commit is contained in:
Yorí authored and GitHub committed 2026-04-29 00:01:48 -05:00
1 parent 87eda4bcfc
commit 1cccf43f7b
12 files changed
+620 -3

No files matched your search

@@ -382,6 +382,24 @@ class CognitoFeaturesTest {
assertThat(resp.users()).isEmpty();
}
@Test
@Order(55)
void describeUserPoolReturnsAllTwentyStandardAttributes() {
DescribeUserPoolResponse resp = cognito.describeUserPool(b -> b.userPoolId(poolId));
List<SchemaAttributeType> schema = resp.userPool().schemaAttributes();
assertThat(schema).hasSize(20);
List<String> names = schema.stream().map(SchemaAttributeType::name).toList();
assertThat(names).contains(
"sub", "name", "given_name", "family_name", "middle_name", "nickname",
"preferred_username", "profile", "picture", "website", "email",
"email_verified", "gender", "birthdate", "zoneinfo", "locale",
"phone_number", "phone_number_verified", "address", "updated_at");
SchemaAttributeType sub = schema.stream().filter(a -> "sub".equals(a.name())).findFirst().orElseThrow();
assertThat(sub.required()).isTrue();
assertThat(sub.mutable()).isFalse();
}
// ── Issue #234 note ───────────────────────────────────────────────────────
// GetTokensFromRefreshToken is tested in sdk-test-node/tests/cognito-features.test.ts
// because GetTokensFromRefreshTokenCommand is not available in Java SDK 2.31.8.