Skip to content

Commit b824833

Browse files
authored
Fix empty xml tag handling for Set shapes (#973)
1 parent db4d768 commit b824833

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
import software.amazon.smithy.model.Model;
2525
import software.amazon.smithy.model.shapes.CollectionShape;
2626
import software.amazon.smithy.model.shapes.DocumentShape;
27+
import software.amazon.smithy.model.shapes.ListShape;
2728
import software.amazon.smithy.model.shapes.MapShape;
2829
import software.amazon.smithy.model.shapes.MemberShape;
30+
import software.amazon.smithy.model.shapes.SetShape;
2931
import software.amazon.smithy.model.shapes.Shape;
3032
import software.amazon.smithy.model.shapes.StructureShape;
3133
import software.amazon.smithy.model.shapes.UnionShape;
@@ -171,9 +173,10 @@ void deserializeNamedMember(
171173
writer.openBlock("if ($L.$L === \"\") {", "}", inputLocation, locationName, () -> {
172174
if (target instanceof MapShape) {
173175
writer.write("contents.$L = {};", memberName);
174-
}
175-
if (target instanceof CollectionShape) {
176+
} else if (target instanceof ListShape) {
176177
writer.write("contents.$L = [];", memberName);
178+
} else if (target instanceof SetShape) {
179+
writer.write("contents.$L = new Set([]);", memberName);
177180
}
178181
});
179182
}

0 commit comments

Comments
 (0)