Skip to content

Commit

Permalink
correct location of union deser import
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Oct 1, 2024
1 parent b401bd9 commit 2ab214d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,6 @@ private HttpBinding readPayload(
+ "= __expectObject(await parseBody(output.body, context));");
} else if (target instanceof UnionShape) {
// If payload is a Union, then we need to parse the string into JavaScript object.
importUnionDeserializer(writer);
writer.write("const data: Record<string, any> | undefined "
+ "= await parseBody(output.body, context);");
} else if (target instanceof StringShape || target instanceof DocumentShape) {
Expand All @@ -2485,6 +2484,7 @@ private HttpBinding readPayload(
"if (Object.keys(data ?? {}).length) {",
"}",
() -> {
importUnionDeserializer(writer);
writer.write("contents.$L = __expectUnion($L);", binding.getMemberName(), getOutputValue(context,
Location.PAYLOAD, "data", binding.getMember(), target));
}
Expand Down

0 comments on commit 2ab214d

Please sign in to comment.