fix(dynamodb): list every CreateTable constraint error in one message (#7974)

* fix(dynamodb): list every CreateTable constraint error in one message

DynamoDB checks the members of a CreateTable request in a fixed order,
whatever order the request gives them: GlobalSecondaryIndexes,
BillingMode, SSESpecification, KeySchema, ProvisionedThroughput,
StreamSpecification, AttributeDefinitions and LocalSecondaryIndexes.
It lists every constraint error in one ValidationException and reports
the first 10. An index name gets its length error before its pattern
error.

* fix(dynamodb): count null list members in CreateTable constraint positions

DynamoDB skips a null list member in the CreateTable constraint checks,
but it still counts it in the positions and in the list length. So
[null] is not an empty list. A quoted NonKeyAttributes list shows the
member as null.

* fix(dynamodb): refuse an empty CreateTable KMSMasterKeyId

DynamoDB refuses a KMSMasterKeyId outside 1 to 2048 characters, counted
in code points, though the API reference gives no length for it.

The billing mode and SSE type checks now print their enum sets from the
same ordered lists as the CreateTable constraint checks.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-11 08:30:07 -04:00
1 parent 3d3e94dcc6
commit 809c003614
5 files changed
+247 -14

No files matched your search

@@ -38,7 +38,8 @@ public class NativeDynamoDbTableService {
private static final String DEFAULT_ACCOUNT_ID = "000000000000";
private static final String SSE_TYPE_KMS = "KMS";
private static final Set<String> VALID_SSE_TYPES = Set.of("AES256", "KMS");
// The order AWS prints the enum constraint in.
static final List<String> SSE_TYPES = List.of("AES256", "KMS");
// A null field or throughput record means "not specified in the request". Collections and the
// settings record must not be null.
@@ -651,11 +652,9 @@ public class NativeDynamoDbTableService {
}
private static void validateSseType(String sseType) {
if (!VALID_SSE_TYPES.contains(sseType)) {
if (!SSE_TYPES.contains(sseType)) {
throw SmithyValidationErrors.validationException(
"Value '" + sseType
+ "' at 'sSESpecification.sSEType' failed to satisfy constraint: "
+ "Member must satisfy enum value set: [AES256, KMS]");
SmithyValidationErrors.notInEnum(sseType, "sSESpecification.sSEType", SSE_TYPES));
}
}