fix(dynamodb): reject an unknown ReturnConsumedCapacity on Scan (#5669)

* fix(dynamodb): reject an unknown ReturnConsumedCapacity on Scan

* refactor(dynamodb): share the ReturnConsumedCapacity enum message for Query and Scan
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-10-14 17:05:12 -04:00
1 parent b395560fe2
commit f3e1cb6006
2 files changed
+36 -5

No files matched your search

@@ -1233,6 +1233,25 @@ class NativeDynamoDbJsonHandlerTest {
+ "Member must have value greater than or equal to 1", ex.getMessage());
}
@Test
void scanRejectsAnUnknownReturnConsumedCapacityBeforeTheTableLookup() {
AwsException ex = expectValidationException("Scan", json("""
{"TableName": "Missing", "ReturnConsumedCapacity": "BOGUS", "Select": "BOGUS"}
"""));
assertEquals("1 validation error detected: Value 'BOGUS' at 'returnConsumedCapacity' "
+ "failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE]",
ex.getMessage());
}
@Test
void scanReportsTheLimitBeforeReturnConsumedCapacity() {
AwsException ex = expectValidationException("Scan", json("""
{"TableName": "Users", "Limit": 0, "ReturnConsumedCapacity": "BOGUS"}
"""));
assertEquals("1 validation error detected: Value at 'Limit' failed to satisfy constraint: "
+ "Member must have value greater than or equal to 1", ex.getMessage());
}
@Test
void scanAcceptsSegmentsAtTheBounds() throws Exception {
createUsersTable("eu-west-1");