Skip to content

Commit e7499a6

Browse files
committed
filterSensitiveLog for Map inside Collection
1 parent bc14a5d commit e7499a6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/StructuredMemberWriter.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ void writeFilterSensitiveLogForCollection(TypeScriptWriter writer, MemberShape c
8686
writeFilterSensitiveLogForCollection(writer, nestedCollectionMember);
8787
}
8888
);
89+
} else if (memberShape instanceof MapShape) {
90+
// Iterate over Object entries, and call reduce to repopulate map
91+
writer.openBlock("item => Object.entries(item).reduce(", ")",
92+
() -> {
93+
MemberShape mapMember = ((MapShape) memberShape).getValue();
94+
writeFilterSensitiveLogForMap(writer, mapMember);
95+
}
96+
);
8997
} else {
9098
// This path will never reach because of recursive isIterationRequired
9199
// adding it to not break the code, if it does reach in future

0 commit comments

Comments
 (0)