Skip to content

Commit 02f600d

Browse files
committed
chore: address PR feedback
1 parent 35ae034 commit 02f600d

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ public Map<String, Consumer<TypeScriptWriter>> getRuntimeConfigWriters(
102102
}
103103
}
104104

105-
private static boolean hasEventStreamInput(
106-
Model model,
107-
ServiceShape service
108-
) {
105+
private static boolean hasEventStreamInput(Model model, ServiceShape service) {
109106
TopDownIndex topDownIndex = model.getKnowledge(TopDownIndex.class);
110107
Set<OperationShape> operations = topDownIndex.getContainedOperations(service);
111108
EventStreamIndex eventStreamIndex = model.getKnowledge(EventStreamIndex.class);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ protected void serializeInputPayload(
207207
writer.write("contents = $L;",
208208
getInputValue(context, Location.PAYLOAD, "input." + memberName, member, target));
209209

210-
// Structure and Union payloads will serialize as XML documents via XmlNode.
210+
// Structure and Union payloads that's not events stream will serialize as XML documents via XmlNode.
211211
if ((target instanceof StructureShape || target instanceof UnionShape)
212-
&& member.hasTrait(EventStreamTrait.class)) {
212+
&& !member.hasTrait(EventStreamTrait.class)) {
213213
// Start with the XML declaration.
214214
writer.write("body = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\";");
215215

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ protected void serializeInputPayload(
147147
MemberShape payloadMember = payloadBinding.getMember();
148148
Shape target = context.getModel().expectShape(payloadMember.getTarget());
149149

150-
// When payload is not event stream and the target is a structure or union, default to an
151-
// empty JSON body instead of an undefined body and make sure any structure or union
150+
// When payload target is a structure or union but payload is not an event stream, default
151+
// to an empty JSON body instead of an undefined body and make sure any structure or union
152152
// content ends up as a JSON string.
153-
if (!payloadMember.hasTrait(EventStreamTrait.class)
154-
&& (target instanceof StructureShape || target instanceof UnionShape)) {
153+
if ((target instanceof StructureShape || target instanceof UnionShape)
154+
&& !payloadMember.hasTrait(EventStreamTrait.class)) {
155155
writer.openBlock("if (body === undefined) {", "}", () -> writer.write("body = {};"));
156156
writer.write("body = JSON.stringify(body);");
157157
}

0 commit comments

Comments
 (0)