fix(dynamodb): list a missing table name in the older PutItem and DeleteItem checks (#8417)

This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-14 23:39:07 -04:00
1 parent d64d02e8f2
commit 558453df20
2 files changed
+7 -2

No files matched your search

@@ -680,7 +680,7 @@ public class NativeDynamoDbJsonHandler {
List.of("ALL_NEW", "UPDATED_OLD", "ALL_OLD", "NONE", "UPDATED_NEW");
private static final List<String> OLDER_CONDITIONAL_OPERATORS = List.of("OR", "AND");
// The older validator lists the members in this order and leaves out a missing table name.
// The older validator lists the members in this order.
private void requireValidOlderItemWrite(JsonNode request, String target) {
String tableName = textOrNull(request, "TableName");
String returnValues = textOrNull(request, "ReturnValues");
@@ -697,7 +697,9 @@ public class NativeDynamoDbJsonHandler {
if ("Key".equals(target) && !request.hasNonNull(target)) {
validationErrors.add(SmithyValidationErrors.notNull("key"));
}
if ("".equals(tableName)) {
if (tableName == null) {
validationErrors.add(SmithyValidationErrors.notNull("tableName"));
} else if (tableName.isEmpty()) {
validationErrors.add(SmithyValidationErrors.lengthTooShort("tableName", "", 1));
}
throwValidationErrors(validationErrors);
@@ -3433,6 +3433,9 @@ class NativeDynamoDbJsonHandlerTest {
UpdateItem | 33 | {"TableName":"Missing","Key":{"pk":{"S":"a","Foo":"y"}},"AttributeUpdates":{"m":{"Action":"PUT","Value":"DEEP"},"a":{"Action":"PUT","Value":{"N":"x"}}}} | Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit
UpdateItem | 33 | {"TableName":"Missing","Key":{"pk":{"S":"a","Foo":"y"}},"UpdateExpression":"SET a = :q + :b + :x + :e + :k + :c","ExpressionAttributeValues":{":q":{"N":"x"},":b":{"S":"x"},":x":{"S":"x"},":e":{"S":"x"},":k":"DEEP",":c":{"S":"x"}}} | ExpressionAttributeValues contains invalid value: Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit for key :k
UpdateItem | 62 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"AttributeUpdates":{"a":{"Action":"PUT","Value":{"S":"x"}}},"Expected":{"e":{"Value":"DEEP"}}} | Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit
PutItem | 63 | {"Item":{"pk":{"S":"a"}},"Expected":{"d":{"Value":"DEEP"}}} | 1 validation error detected: Value null at 'tableName' failed to satisfy constraint: Member must not be null
PutItem | 63 | {"Item":{"pk":{"S":"a"}},"Expected":{"d":{"Value":"DEEP"}},"ReturnValues":"BOGUS"} | 2 validation errors detected: Value 'BOGUS' at 'returnValues' failed to satisfy constraint: Member must satisfy enum value set: [ALL_NEW, UPDATED_OLD, ALL_OLD, NONE, UPDATED_NEW]; Value null at 'tableName' failed to satisfy constraint: Member must not be null
DeleteItem | 0 | {"TableName":null,"ConditionalOperator":"XOR"} | 3 validation errors detected: Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]; Value null at 'key' failed to satisfy constraint: Member must not be null; Value null at 'tableName' failed to satisfy constraint: Member must not be null
UpdateItem | 0 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"AttributeUpdates":{"a":{"Action":"PUT","Value":{"S":"x","Foo":"y"}}},"ReturnValues":"BOGUS"} | 1 validation error detected: Value 'BOGUS' at 'returnValues' failed to satisfy constraint: Member must satisfy enum value set: [ALL_NEW, UPDATED_OLD, ALL_OLD, NONE, UPDATED_NEW]
""")
void theOlderValidatorChecksAnItemWriteTheNewerOneGivesUpOn(String operation, int levels,