mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(iam): name a map entry's field under .member, as AWS does (#7457)
A violation inside a map entry's structure named the entry and then the field, replacementValues.Department.values. An AWS-validated recording of the same protocol writes a segment between the two: SNS answers a missing DataType inside its MessageAttributes map as 1 validation error detected: Value null at 'messageAttributes.attr1.member.dataType' failed to satisfy constraint: Member must not be null and, inside a list's member, publishBatchRequestEntries.1.member.messageAttributes.attr1.member.dataType. So a map of structures is named the way a list of structures already is here, the entry's key standing where a list's index stands, and the walk now writes replacementValues.Department.member.values. AcquireRole is the one operation that reaches it, its ReplacementValues being the only structure-valued map these two services vendor. What stays is the scalar-valued map. Nothing recorded covers one on this protocol, and the only recording anywhere, Lambda's routingConfig.additionalVersionWeights on REST-JSON, answers the map rather than the entry with "Map value must satisfy constraint: [...]". A different protocol and a different service is not evidence against the answer this service already gave, so properties.Team/Owner stays as it is, with what would move it written down beside it. The core walk had no test for a structure under a map's key at all, every case in that file holding a scalar, so one is added there rather than left to the two IAM wire tests that quote the path. docs/services/iam.md carries both halves, the recorded one and the open one. The message's other half, the word null in the value slot, is IAM's own and does not move: that service leaves it out and this is only the path.
This commit is contained in:
1 parent
d098a4729a
commit
a90b812cc6
5 files changed
+89
-36
No files matched your search
@@ -61,8 +61,12 @@ class QueryConstraintCheckTest {
|
||||
"operations": {"Acquire": "AcquireRequest"},
|
||||
"shapes": {
|
||||
"AcquireRequest": {"type": "structure", "required": ["Values"], "members": {
|
||||
"Values": "valueMap", "Nested": "nestedType", "Entries": "entryList"}},
|
||||
"Values": "valueMap", "Nested": "nestedType", "Entries": "entryList",
|
||||
"Replacements": "replacementMap"}},
|
||||
"valueMap": {"type": "map", "key": "keyType", "value": "valueType", "max": 2},
|
||||
"replacementMap": {"type": "map", "key": "keyType", "value": "replacementType"},
|
||||
"replacementType": {"type": "structure", "required": ["Values"], "members": {
|
||||
"Values": "nameList"}},
|
||||
"nestedType": {"type": "structure", "members": {
|
||||
"Arn": "arnType", "Parameters": "nameList"}},
|
||||
"entryList": {"type": "list", "member": "entryType"},
|
||||
@@ -564,6 +568,34 @@ class QueryConstraintCheckTest {
|
||||
"Values.entry.3.key", "c", "Values.entry.3.value", "z")));
|
||||
}
|
||||
|
||||
/**
|
||||
* A map whose value is a structure names the field under {@code .member} after the key, which
|
||||
* is the form AWS writes on this protocol: an AWS-validated SNS recording answers a missing
|
||||
* {@code DataType} inside one as
|
||||
* {@code Value null at 'messageAttributes.attr1.member.dataType'}. A scalar value stays at the
|
||||
* key, as the test above has it, nothing recorded covering one here.
|
||||
*/
|
||||
@Test
|
||||
void aStructureUnderAMapsKeyNamesItsFieldUnderMember() throws Exception {
|
||||
// `keyType` is 4 characters, so the key is short enough to break nothing of its own and
|
||||
// leave the field inside the entry as the only violation.
|
||||
assertEquals(List.of("Value null at 'replacements.Dept.member.values' failed to satisfy"
|
||||
+ " constraint: Member must not be null"),
|
||||
maps().violations("Acquire", params(
|
||||
"Values.entry.1.key", "k", "Values.entry.1.value", "ok",
|
||||
"Replacements.entry.1.key", "Dept")));
|
||||
|
||||
assertEquals(List.of("Value at 'replacements.Dept.member.values' failed to satisfy"
|
||||
+ " constraint: Member must have length less than or equal to 2"),
|
||||
maps().violations("Acquire", params(
|
||||
"Values.entry.1.key", "k", "Values.entry.1.value", "ok",
|
||||
"Replacements.entry.1.key", "Dept",
|
||||
"Replacements.entry.1.value.Values.member.1", "a",
|
||||
"Replacements.entry.1.value.Values.member.2", "b",
|
||||
"Replacements.entry.1.value.Values.member.3", "c")),
|
||||
"and the list inside that structure is held to its own bounds under the same path");
|
||||
}
|
||||
|
||||
/** A map the request names nowhere is the required member reading as null. */
|
||||
@Test
|
||||
void aMapNamedNowhereIsTheRequiredMemberReadingAsNull() throws Exception {
|
||||
|
||||
+4
-3
@@ -348,7 +348,8 @@ class IamRequestConstraintsIntegrationTest {
|
||||
* deepest request this service models: {@code AcquireRole} numbers its replacement values as
|
||||
* entries and each entry's structure carries a list of its own. An entry the request numbered
|
||||
* with a key is an entry, so what the structure under it requires is answered inside it, named
|
||||
* under that key, which is the answer the hand-written check this replaces already gave.
|
||||
* under that key with {@code .member} after it, which is the form AWS writes for a map of
|
||||
* structures on this protocol.
|
||||
*/
|
||||
@Test
|
||||
void aMapValuesStructureAndTheListInsideItAreRead() {
|
||||
@@ -358,8 +359,8 @@ class IamRequestConstraintsIntegrationTest {
|
||||
.when().post("/").then().statusCode(400)
|
||||
.body(CODE, equalTo("ValidationError"))
|
||||
.body(MESSAGE, equalTo("1 validation error detected: Value at"
|
||||
+ " 'replacementValues.Department.values' failed to satisfy constraint: Member"
|
||||
+ " must not be null"));
|
||||
+ " 'replacementValues.Department.member.values' failed to satisfy constraint:"
|
||||
+ " Member must not be null"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+9
-9
@@ -176,8 +176,8 @@ class RoleTemplateIntegrationTest {
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", equalTo("1 validation error detected: Value "
|
||||
+ "at 'replacementValues.Department.values' failed to satisfy constraint: "
|
||||
+ "Member must not be null"))
|
||||
+ "at 'replacementValues.Department.member.values' failed to satisfy "
|
||||
+ "constraint: Member must not be null"))
|
||||
.body(not(containsString("NoSuchEntity")));
|
||||
}
|
||||
|
||||
@@ -191,8 +191,8 @@ class RoleTemplateIntegrationTest {
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", equalTo("1 validation error detected: Value at "
|
||||
+ "'replacementValues.Department.values' failed to satisfy constraint: Member "
|
||||
+ "must have length less than or equal to 20"));
|
||||
+ "'replacementValues.Department.member.values' failed to satisfy constraint: "
|
||||
+ "Member must have length less than or equal to 20"));
|
||||
|
||||
acquireWithValues(20).when().post("/").then()
|
||||
.statusCode(404)
|
||||
@@ -255,8 +255,8 @@ class RoleTemplateIntegrationTest {
|
||||
.when().post("/").then()
|
||||
.statusCode(400)
|
||||
.body("ErrorResponse.Error.Message", equalTo("1 validation error detected: Value "
|
||||
+ "at 'replacementValues.Department.values' failed to satisfy constraint: "
|
||||
+ "Member must not be null"));
|
||||
+ "at 'replacementValues.Department.member.values' failed to satisfy "
|
||||
+ "constraint: Member must not be null"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,9 +280,9 @@ class RoleTemplateIntegrationTest {
|
||||
.body("ErrorResponse.Error.Code", equalTo("ValidationError"))
|
||||
.body("ErrorResponse.Error.Message", equalTo("3 validation errors detected: Value at "
|
||||
+ "'replacementValues' failed to satisfy constraint: Member must have length "
|
||||
+ "less than or equal to 30; Value at 'replacementValues.Parameter2."
|
||||
+ "less than or equal to 30; Value at 'replacementValues.Parameter2.member."
|
||||
+ "values' failed to satisfy constraint: Member must not be null; Value "
|
||||
+ "at 'replacementValues.Parameter10.values' failed to satisfy constraint: "
|
||||
+ "Member must not be null"));
|
||||
+ "at 'replacementValues.Parameter10.member.values' failed to satisfy "
|
||||
+ "constraint: Member must not be null"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user