diff --git a/src/main/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandler.java b/src/main/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandler.java index 3214c16834..99a3adc929 100644 --- a/src/main/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandler.java +++ b/src/main/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandler.java @@ -680,7 +680,7 @@ public class NativeDynamoDbJsonHandler { List.of("ALL_NEW", "UPDATED_OLD", "ALL_OLD", "NONE", "UPDATED_NEW"); private static final List 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); diff --git a/src/test/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandlerTest.java b/src/test/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandlerTest.java index 1655a06ade..20a3c18bdf 100644 --- a/src/test/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandlerTest.java +++ b/src/test/java/io/floci/aws/services/dynamodb/NativeDynamoDbJsonHandlerTest.java @@ -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,