Skip to content

Commit 17afaf5

Browse files
committed
chore: remove mapParams object from deser function
1 parent bbd3473 commit 17afaf5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/XmlShapeDeserVisitor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,12 @@ protected void deserializeMap(GenerationContext context, MapShape shape) {
106106

107107
// Get the right serialization for each entry in the map. Undefined
108108
// outputs won't have this deserializer invoked.
109-
writer.write("const mapParams: any = {};");
110-
writer.openBlock("output.forEach((pair: any) => {", "});", () -> {
109+
writer.openBlock("return output.reduce((acc: any, pair: any) => {", "}, {});", () -> {
111110
// Dispatch to the output value provider for any additional handling.
112111
String dataSource = getUnnamedTargetWrapper(context, target, "pair[\"" + valueLocation + "\"]");
113-
writer.write("mapParams[pair[$S]] = $L;", keyLocation, target.accept(getMemberVisitor(dataSource)));
112+
writer.write("acc[pair[$S]] = $L;", keyLocation, target.accept(getMemberVisitor(dataSource)));
113+
writer.write("return acc;");
114114
});
115-
writer.write("return mapParams;");
116115
}
117116

118117
@Override

0 commit comments

Comments
 (0)