mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(dynamodb): use the older check order and wording for an UpdateItem without Key or nested too deep (#7608)
This commit is contained in:
1 parent
bc9f7b518d
commit
ddfc63f6b6
3 files changed
+119
-25
No files matched your search
+96
-23
@@ -617,7 +617,7 @@ public class NativeDynamoDbJsonHandler {
|
||||
|
||||
// DynamoDB's newer validator gives up on an attribute value with a member it does not know.
|
||||
// It leaves the other unknown members out when it measures how deep a request nests.
|
||||
private static boolean readByOlderValidator(JsonNode request, String target) {
|
||||
private static boolean readByOlderValidator(JsonNode request, String target, List<String> legacyMembers) {
|
||||
if (!request.hasNonNull(target)) {
|
||||
return true;
|
||||
}
|
||||
@@ -625,12 +625,14 @@ public class NativeDynamoDbJsonHandler {
|
||||
request.path(target).forEach(values::add);
|
||||
request.path("ExpressionAttributeValues").forEach(values::add);
|
||||
int deepest = Math.max(jsonDepth(request.path(target)), jsonDepth(request.path("ExpressionAttributeValues")));
|
||||
for (JsonNode condition : request.path("Expected")) {
|
||||
values.add(condition.path("Value"));
|
||||
condition.path("AttributeValueList").forEach(values::add);
|
||||
int known = Math.max(jsonDepth(condition.path("Value")), jsonDepth(condition.path("AttributeValueList")));
|
||||
// Expected and the condition hold these members.
|
||||
deepest = Math.max(deepest, known + 2);
|
||||
for (String member : legacyMembers) {
|
||||
for (JsonNode entry : request.path(member)) {
|
||||
values.add(entry.path("Value"));
|
||||
entry.path("AttributeValueList").forEach(values::add);
|
||||
int known = Math.max(jsonDepth(entry.path("Value")), jsonDepth(entry.path("AttributeValueList")));
|
||||
// The member and its entry hold these members.
|
||||
deepest = Math.max(deepest, known + 2);
|
||||
}
|
||||
}
|
||||
// The request holds these members.
|
||||
return deepest + 1 >= OLDER_VALIDATOR_DEPTH
|
||||
@@ -646,14 +648,9 @@ public class NativeDynamoDbJsonHandler {
|
||||
String tableName = textOrNull(request, "TableName");
|
||||
String returnValues = textOrNull(request, "ReturnValues");
|
||||
List<String> validationErrors = new ArrayList<>();
|
||||
if (returnValues != null && !OLDER_RETURN_VALUES.contains(returnValues)) {
|
||||
validationErrors.add(SmithyValidationErrors.notInEnum(returnValues, "returnValues", OLDER_RETURN_VALUES));
|
||||
}
|
||||
String conditionalOperator = textOrNull(request, "ConditionalOperator");
|
||||
if (conditionalOperator != null && !OLDER_CONDITIONAL_OPERATORS.contains(conditionalOperator)) {
|
||||
validationErrors.add(SmithyValidationErrors.notInEnum(conditionalOperator, "conditionalOperator",
|
||||
OLDER_CONDITIONAL_OPERATORS));
|
||||
}
|
||||
addOlderEnumError(request, "ReturnValues", "returnValues", OLDER_RETURN_VALUES, validationErrors);
|
||||
addOlderEnumError(request, "ConditionalOperator", "conditionalOperator", OLDER_CONDITIONAL_OPERATORS,
|
||||
validationErrors);
|
||||
if ("Item".equals(target) && !request.hasNonNull(target)) {
|
||||
validationErrors.add(SmithyValidationErrors.notNull("item"));
|
||||
}
|
||||
@@ -683,17 +680,90 @@ public class NativeDynamoDbJsonHandler {
|
||||
}
|
||||
rejectExprAttrsWithoutExpression(null, request.get("ExpressionAttributeValues"),
|
||||
request.has("ConditionExpression"), "ConditionExpression is null");
|
||||
JsonNode values = request.get(target);
|
||||
DynamoDbAttributeValueValidator.requireNestingWithinLimit(values, false);
|
||||
requireReadableValues(values, "");
|
||||
DynamoDbAttributeValueValidator.requireNonEmptyNames(values);
|
||||
DynamoDbAttributeValueValidator.requireNonEmptyMemberNames(values);
|
||||
requireStorableInReadOrder(request.get(target));
|
||||
requireNamedExpressionValues(request.get("ExpressionAttributeValues"));
|
||||
DynamoDbAttributeValueValidator.requireNestingWithinLimit(legacyValues(request.get("Expected")), false);
|
||||
}
|
||||
|
||||
private static final List<String> OLDER_COMPARISON_OPERATORS = List.of("IN", "NULL", "BETWEEN", "LT",
|
||||
"NOT_CONTAINS", "EQ", "GT", "NOT_NULL", "NE", "LE", "BEGINS_WITH", "GE", "CONTAINS");
|
||||
private static final List<String> OLDER_UPDATE_ACTIONS = List.of("ADD", "DELETE", "PUT");
|
||||
|
||||
// The older validator lists the members in this order and reports the first 10 errors.
|
||||
private void requireValidOlderUpdate(JsonNode request) {
|
||||
List<String> validationErrors = new ArrayList<>();
|
||||
inReadOrder(request.path("Expected")).forEach((name, condition) -> addOlderEnumError(condition,
|
||||
"ComparisonOperator", "expected." + name + ".member.comparisonOperator", OLDER_COMPARISON_OPERATORS,
|
||||
validationErrors));
|
||||
addReturnConsumedCapacityError(request, validationErrors);
|
||||
String tableName = textOrNull(request, "TableName");
|
||||
if (tableName == null) {
|
||||
validationErrors.add(SmithyValidationErrors.notNull("tableName"));
|
||||
} else if (tableName.isEmpty()) {
|
||||
validationErrors.add(SmithyValidationErrors.lengthTooShort("tableName", "", 1));
|
||||
}
|
||||
addOlderEnumError(request, "ReturnValues", "returnValues", OLDER_RETURN_VALUES, validationErrors);
|
||||
addOlderEnumError(request, "ConditionalOperator", "conditionalOperator", OLDER_CONDITIONAL_OPERATORS,
|
||||
validationErrors);
|
||||
addPartiQLReturnValuesError(request, "returnValuesOnConditionCheckFailure", validationErrors);
|
||||
inReadOrder(request.path("AttributeUpdates")).forEach((name, update) -> addOlderEnumError(update, "Action",
|
||||
"attributeUpdates." + name + ".member.action", OLDER_UPDATE_ACTIONS, validationErrors));
|
||||
addIfPresent(validationErrors, returnItemCollectionMetricsError(request));
|
||||
if (!request.hasNonNull("Key")) {
|
||||
validationErrors.add(SmithyValidationErrors.notNull("key"));
|
||||
}
|
||||
throwValidationErrors(validationErrors.subList(0, Math.min(validationErrors.size(), 10)));
|
||||
|
||||
if (AwsArnUtils.looksLikeArn(tableName)) {
|
||||
DynamoDbTableNames.resolve(tableName);
|
||||
} else {
|
||||
throwValidationErrors(DynamoDbTableNames.nameViolations(tableName));
|
||||
}
|
||||
rejectMixedParameters(request, List.of("AttributeUpdates", "Expected", "ConditionalOperator"),
|
||||
List.of("UpdateExpression", "ConditionExpression"));
|
||||
boolean usesExpressions = request.has("UpdateExpression") || request.has("ConditionExpression");
|
||||
if (!usesExpressions) {
|
||||
requireAbsentWithoutExpression(request.get("ExpressionAttributeNames"), "ExpressionAttributeNames");
|
||||
}
|
||||
rejectExprAttrsWithoutExpression(null, request.get("ExpressionAttributeValues"), usesExpressions,
|
||||
"UpdateExpression and ConditionExpression are null");
|
||||
requireStorableInReadOrder(request.get("Key"));
|
||||
ObjectNode updateValues = objectMapper.createObjectNode();
|
||||
request.path("AttributeUpdates").properties()
|
||||
.forEach(update -> updateValues.set(update.getKey(), update.getValue().path("Value")));
|
||||
requireStorableInReadOrder(updateValues);
|
||||
requireNamedExpressionValues(request.get("ExpressionAttributeValues"));
|
||||
DynamoDbAttributeValueValidator.requireNestingWithinLimit(legacyValues(request.get("Expected")), false);
|
||||
}
|
||||
|
||||
// The older validator walks a map in the order of a Java HashMap that starts with one bucket.
|
||||
private static Map<String, JsonNode> inReadOrder(JsonNode map) {
|
||||
Map<String, JsonNode> entries = new HashMap<>(1);
|
||||
map.properties().forEach(entry -> entries.put(entry.getKey(), entry.getValue()));
|
||||
return entries;
|
||||
}
|
||||
|
||||
// The older validator checks each attribute in full before the next one.
|
||||
private void requireStorableInReadOrder(JsonNode attributes) {
|
||||
for (Map.Entry<String, JsonNode> attribute : inReadOrder(attributes).entrySet()) {
|
||||
ObjectNode value = objectMapper.createObjectNode().set(attribute.getKey(), attribute.getValue());
|
||||
DynamoDbAttributeValueValidator.requireNonEmptyNames(value);
|
||||
DynamoDbAttributeValueValidator.requireNestingWithinLimit(value, false);
|
||||
DynamoDbAttributeValueValidator.requireNonEmptyMemberNames(value);
|
||||
requireReadableValues(value, "");
|
||||
}
|
||||
}
|
||||
|
||||
private static void addOlderEnumError(JsonNode node, String member, String path, List<String> allowed,
|
||||
List<String> validationErrors) {
|
||||
String value = textOrNull(node, member);
|
||||
if (value != null && !allowed.contains(value)) {
|
||||
validationErrors.add(SmithyValidationErrors.notInEnum(value, path, allowed));
|
||||
}
|
||||
}
|
||||
|
||||
private Response handlePutItem(JsonNode request, String region) {
|
||||
if (readByOlderValidator(request, "Item")) {
|
||||
if (readByOlderValidator(request, "Item", List.of("Expected"))) {
|
||||
requireValidOlderItemWrite(request, "Item");
|
||||
}
|
||||
String tableName = request.has("TableName") ? request.path("TableName").asText() : null;
|
||||
@@ -824,7 +894,7 @@ public class NativeDynamoDbJsonHandler {
|
||||
Set.of("NONE", "ALL_OLD", "ALL_NEW", "UPDATED_OLD", "UPDATED_NEW");
|
||||
|
||||
private Response handleDeleteItem(JsonNode request, String region) {
|
||||
if (readByOlderValidator(request, "Key")) {
|
||||
if (readByOlderValidator(request, "Key", List.of("Expected"))) {
|
||||
requireValidOlderItemWrite(request, "Key");
|
||||
}
|
||||
String tableName = request.path("TableName").asText();
|
||||
@@ -861,6 +931,9 @@ public class NativeDynamoDbJsonHandler {
|
||||
}
|
||||
|
||||
private Response handleUpdateItem(JsonNode request, String region) {
|
||||
if (readByOlderValidator(request, "Key", List.of("Expected", "AttributeUpdates"))) {
|
||||
requireValidOlderUpdate(request);
|
||||
}
|
||||
String tableName = request.path("TableName").asText();
|
||||
DynamoDbTableNames.resolve(tableName); // validate tableName first
|
||||
JsonNode key = request.path("Key");
|
||||
@@ -2935,7 +3008,7 @@ public class NativeDynamoDbJsonHandler {
|
||||
if (exprAttrValues == null) {
|
||||
return;
|
||||
}
|
||||
for (Map.Entry<String, JsonNode> entry : exprAttrValues.properties()) {
|
||||
for (Map.Entry<String, JsonNode> entry : inReadOrder(exprAttrValues).entrySet()) {
|
||||
ObjectNode value = objectMapper.createObjectNode().set(entry.getKey(), entry.getValue());
|
||||
try {
|
||||
DynamoDbAttributeValueValidator.requireNestingWithinLimit(value, false);
|
||||
|
||||
+5
-1
@@ -5889,8 +5889,12 @@ given()
|
||||
PutItem | {"TableName": "Missing", "Item": {"pk": {"S": "a"}}, "Expected": {"a": {"Value": "DEEP"}, "b": {"Exists": false}}, "ConditionalOperator": "XOR"} | 1 validation error detected: Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]
|
||||
DeleteItem | {"TableName": "Missing", "Key": {"pk": "DEEP"}, "ReturnValues": "UPDATED_NEW"} | ReturnValues can only be ALL_OLD or NONE
|
||||
PutItem | {"TableName": "Missing", "Item": {"pk": {"S": "a"}, "d": {"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]
|
||||
UpdateItem | {"TableName": "", "UpdateExpression": "SET a = :a", "ExpressionAttributeValues": {":a": {"S": "x"}}, "ReturnConsumedCapacity": "BOGUS", "ReturnValues": "BOGUS"} | 4 validation errors detected: Value 'BOGUS' at 'returnConsumedCapacity' failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE]; Value '' at 'tableName' failed to satisfy constraint: Member must have length greater than or equal to 1; 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 'key' failed to satisfy constraint: Member must not be null
|
||||
UpdateItem | {"TableName": "Missing", "AttributeUpdates": {"a": {"Action": "BOGUS", "Value": {"S": "x"}}}} | 2 validation errors detected: Value 'BOGUS' at 'attributeUpdates.a.member.action' failed to satisfy constraint: Member must satisfy enum value set: [ADD, DELETE, PUT]; Value null at 'key' failed to satisfy constraint: Member must not be null
|
||||
UpdateItem | {"TableName": "Missing", "Key": {"pk": {"S": "a"}}, "AttributeUpdates": {"x": {"Action": "PUT", "Value": {"S": "1"}}}, "Expected": {"a": {"Value": "DEEP"}, "b": {"Exists": false}}, "ConditionalOperator": "XOR"} | 1 validation error detected: Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]
|
||||
UpdateItem | {"TableName": "Missing", "Key": {"pk": {"S": "a"}}, "UpdateExpression": "SET t = :t", "ConditionExpression": "d = :deep", "ExpressionAttributeValues": {":t": {"S": "y"}, ":deep": "DEEP"}} | ExpressionAttributeValues contains invalid value: Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit for key :deep
|
||||
""")
|
||||
void putAndDeleteItemGetTheOlderChecksWhenTheNewerValidatorGivesUp(String operation, String body,
|
||||
void itemWritesGetTheOlderChecksWhenTheNewerValidatorGivesUp(String operation, String body,
|
||||
String message) {
|
||||
String deep = "{\"M\": {\"n\": ".repeat(63) + "{\"S\": \"leaf\"}" + "}}".repeat(63);
|
||||
given()
|
||||
|
||||
+18
-1
@@ -2415,8 +2415,24 @@ class NativeDynamoDbJsonHandlerTest {
|
||||
PutItem | 0 | {"TableName":"Missing","Item":{"pk":{"S":"a"},"d":{"L":[{"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]
|
||||
DeleteItem | 0 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"Expected":{"d":{"ComparisonOperator":"IN","AttributeValueList":[{"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]
|
||||
DeleteItem | 63 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"Expected":{"d":{"Value":{"S":"x"},"Foo":"DEEP"}},"ReturnValues":"BOGUS"} | 1 validation error detected: Failed to satisfy constraint: Member must satisfy enum value set: [ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATE_NEW, NONE]
|
||||
PutItem | 63 | {"TableName":"Missing","Item":{"pk":"DEEP","n":{"N":"x"}}} | The parameter cannot be converted to a numeric value: x
|
||||
DeleteItem | 63 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"ConditionExpression":"#d = :a OR #d = :b","ExpressionAttributeNames":{"#d":"d"},"ExpressionAttributeValues":{":a":"DEEP",":b":"DEEP"}} | ExpressionAttributeValues contains invalid value: Nesting Levels have exceeded supported limits: Attributes in the item have nested levels beyond supported limit for key :b
|
||||
UpdateItem | 0 | {"TableName":"","AttributeUpdates":{"b":{"Action":"BOGUS2"},"a":{"Action":"BOGUS"}},"Expected":{"k":{"ComparisonOperator":"BOGUS2"},"i":{"ComparisonOperator":"BOGUS"}},"ReturnValues":"BOGUS","ConditionalOperator":"XOR","ReturnValuesOnConditionCheckFailure":"BOGUS","ReturnConsumedCapacity":"BOGUS","ReturnItemCollectionMetrics":"BOGUS"} | 10 validation errors detected: Value 'BOGUS' at 'expected.i.member.comparisonOperator' failed to satisfy constraint: Member must satisfy enum value set: [IN, NULL, BETWEEN, LT, NOT_CONTAINS, EQ, GT, NOT_NULL, NE, LE, BEGINS_WITH, GE, CONTAINS]; Value 'BOGUS2' at 'expected.k.member.comparisonOperator' failed to satisfy constraint: Member must satisfy enum value set: [IN, NULL, BETWEEN, LT, NOT_CONTAINS, EQ, GT, NOT_NULL, NE, LE, BEGINS_WITH, GE, CONTAINS]; Value 'BOGUS' at 'returnConsumedCapacity' failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE]; Value '' at 'tableName' failed to satisfy constraint: Member must have length greater than or equal to 1; Value 'BOGUS' at 'returnValues' failed to satisfy constraint: Member must satisfy enum value set: [ALL_NEW, UPDATED_OLD, ALL_OLD, NONE, UPDATED_NEW]; Value 'XOR' at 'conditionalOperator' failed to satisfy constraint: Member must satisfy enum value set: [OR, AND]; Value 'BOGUS' at 'returnValuesOnConditionCheckFailure' failed to satisfy constraint: Member must satisfy enum value set: [ALL_OLD, NONE]; Value 'BOGUS' at 'attributeUpdates.a.member.action' failed to satisfy constraint: Member must satisfy enum value set: [ADD, DELETE, PUT]; Value 'BOGUS2' at 'attributeUpdates.b.member.action' failed to satisfy constraint: Member must satisfy enum value set: [ADD, DELETE, PUT]; Value 'BOGUS' at 'returnItemCollectionMetrics' failed to satisfy constraint: Member must satisfy enum value set: [SIZE, NONE]
|
||||
UpdateItem | 0 | {"AttributeUpdates":{"a":{"Action":"PUT","Value":{"S":"x"}}}} | 2 validation errors detected: Value null at 'tableName' failed to satisfy constraint: Member must not be null; Value null at 'key' failed to satisfy constraint: Member must not be null
|
||||
UpdateItem | 62 | {"TableName":"a!","Key":{"pk":{"S":"a"}},"AttributeUpdates":{"a":{"Action":"PUT","Value":"DEEP"}}} | 2 validation errors detected: Value 'a!' at 'tableName' failed to satisfy constraint: Member must have length greater than or equal to 3; Value 'a!' at 'tableName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z0-9_.-]+
|
||||
UpdateItem | 63 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"UpdateExpression":"SET a = :a","ConditionExpression":"a = = b","ExpressionAttributeValues":{":a":"DEEP"},"AttributeUpdates":{"b":{"Action":"PUT","Value":{"S":"1"}}},"Expected":{"b":{"Exists":false}},"ConditionalOperator":"AND"} | Can not use both expression and non-expression parameters in the same request: Non-expression parameters: {AttributeUpdates, Expected, ConditionalOperator} Expression parameters: {UpdateExpression, ConditionExpression}
|
||||
UpdateItem | 62 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"AttributeUpdates":{"a":{"Action":"PUT","Value":"DEEP"}},"ExpressionAttributeValues":{":v":{"S":"v"}},"ExpressionAttributeNames":{"#n":"n"}} | ExpressionAttributeNames can only be specified when using expressions
|
||||
UpdateItem | 62 | {"TableName":"Missing","Key":{"pk":{"S":"a"}},"AttributeUpdates":{"a":{"Action":"PUT","Value":"DEEP"}},"ExpressionAttributeValues":{":v":{"S":"v"}}} | ExpressionAttributeValues can only be specified when using expressions: UpdateExpression and ConditionExpression are null
|
||||
UpdateItem | 33 | {"TableName":"Missing","Key":{"pk":"DEEP","n":{"N":"x"}},"UpdateExpression":"SET a = :a","ExpressionAttributeValues":{":a":{"S":"x","Foo":"y"}}} | The parameter cannot be converted to a numeric value: x
|
||||
UpdateItem | 0 | {"TableName":"Missing","Key":{"pk":{"S":"a","Foo":"y"},"z":{"N":"x"},"m":{"M":{"":{"S":"x"}}}},"AttributeUpdates":{"a":{"Action":"PUT","Value":{"N":"y"}}}} | Empty attribute name
|
||||
UpdateItem | 0 | {"TableName":"Missing","Key":{"pk":{"S":"a","Foo":"y"},"n":{"N":"x"}},"AttributeUpdates":{"":{"Action":"PUT","Value":{"S":"x"}},"a":{"Action":"PUT","Value":{"S":"x"}}}} | The parameter cannot be converted to a numeric value: x
|
||||
UpdateItem | 0 | {"TableName":"Missing","Key":{"pk":{"S":"a","Foo":"y"}},"AttributeUpdates":{"z":{"Action":"PUT","Value":{"N":"x"}},"m":{"Action":"PUT","Value":{"M":{"":{"S":"x"}}}}}} | Empty attribute name
|
||||
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
|
||||
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 theOlderValidatorChecksAPutOrDeleteTheNewerOneGivesUpOn(String operation, int levels,
|
||||
void theOlderValidatorChecksAnItemWriteTheNewerOneGivesUpOn(String operation, int levels,
|
||||
String request, String message) throws Exception {
|
||||
JsonNode body = mapper.readTree(request.replace("\"DEEP\"", mapper.writeValueAsString(nestedMaps(levels))));
|
||||
|
||||
@@ -2432,6 +2448,7 @@ class NativeDynamoDbJsonHandlerTest {
|
||||
61 | {"TransactItems":[{"Put":{"TableName":"","Item":{}}}]} | 1 validation error detected: Value '' at 'transactItems.1.member.put.tableName' failed to satisfy constraint: Member must have length greater than or equal to 1
|
||||
60 | {"TransactItems":[{"Put":{"TableName":"","Item":{}}}]} | 1 validation error detected: Value at 'TransactItems.0.member.Put.TableName' failed to satisfy constraint: Member must have length greater than or equal to 1
|
||||
60 | {"TransactItems":[{}],"ReturnConsumedCapacity":"BOGUS"} | 2 validation errors detected: Value '' at 'transactItems' failed to satisfy constraint: TransactWriteRequest should contain Delete or Put or Update or ConditionCheck; Value 'BOGUS' at 'returnConsumedCapacity' failed to satisfy constraint: Member must satisfy enum value set: [INDEXES, TOTAL, NONE]
|
||||
63 | {"TransactItems":[{"ConditionCheck":{"TableName":"Missing","Key":{"pk":{"S":"a"}},"ConditionExpression":"a IN (:q, :b, :x, :e, :k, :c)","ExpressionAttributeValues":{":q":{"N":"x"},":b":{"S":"x"},":x":{"S":"x"},":e":{"S":"x"},":k":{"N":"y"},":c":{"S":"x"}}}}]} | ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: y for key :k
|
||||
""")
|
||||
void aTransactionNestedTooDeepForTheNewerValidatorIsCheckedByTheOlderOne(int levels, String request,
|
||||
String message) throws Exception {
|
||||
|
||||
Reference in new issue
Block a user