Skip to content

Commit

Permalink
fix: xml map serializer (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell authored Jan 14, 2020
1 parent 114d6a0 commit 9e81bd4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ protected void serializeMap(GenerationContext context, MapShape shape) {
Shape valueTarget = model.expectShape(valueMember.getTarget());
String valueName = valueMember.getTrait(XmlNameTrait.class)
.map(XmlNameTrait::getValue)
.orElse("key");
writer.write("const keyNode = new __XmlNode($S);", valueName);
writer.write("keyNode.addChildNode($L)", valueTarget.accept(getMemberVisitor("input[key]")));
writer.write("entryNode.addChildNode(keyNode);");
.orElse("value");
writer.write("const valueNode = new __XmlNode($S);", valueName);
writer.write("valueNode.addChildNode($L)", valueTarget.accept(getMemberVisitor("input[key]")));
writer.write("entryNode.addChildNode(valueNode);");

// Add the entry to the collection.
writer.write("collectedNodes.push(entryNode);");
Expand Down

0 comments on commit 9e81bd4

Please sign in to comment.