fix(dynamodb): use the AWS wording when Query or Scan rejects AttributesToGet with a Select (#5599)

* fix(dynamodb): use the AWS wording when Query or Scan rejects AttributesToGet with a Select

* refactor(dynamodb): share the Select conflict check for ProjectionExpression and AttributesToGet
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-10-13 21:37:02 -04:00
1 parent ddc0e0257b
commit dd0f40fcbb
2 files changed
+34 -8

No files matched your search

@@ -1159,6 +1159,30 @@ class NativeDynamoDbJsonHandlerTest {
+ "when Querying using an IndexName", allProjected.getMessage());
}
@Test
void scanNamesTheSelectWhenRejectingAttributesToGet() {
createUsersTable("eu-west-1");
AwsException ex = expectValidationException("Scan", json("""
{"TableName": "Users", "Select": "COUNT", "AttributesToGet": ["userId"]}
"""));
assertEquals("1 validation error detected: Cannot specify the AttributesToGet "
+ "when choosing to get only the Count", ex.getMessage());
}
@Test
void queryReportsTheAttributesToGetConflictBeforeTheMissingIndex() {
createUsersTable("eu-west-1");
AwsException ex = expectValidationException("Query", json("""
{"TableName": "Users",
"KeyConditions": {"userId": {"ComparisonOperator": "EQ", "AttributeValueList": [{"S": "a"}]}},
"Select": "ALL_PROJECTED_ATTRIBUTES", "AttributesToGet": ["userId"]}
"""));
assertEquals("1 validation error detected: Cannot specify the AttributesToGet "
+ "when choosing to get ALL_PROJECTED_ATTRIBUTES", ex.getMessage());
}
@Test
void scanAcceptsSegmentsAtTheBounds() throws Exception {
createUsersTable("eu-west-1");