Skip to content

Commit 757f883

Browse files
authored
fix(client-lex-runtime-v2): serialize eventstream payload properly (#3655)
* fix(client-lex-runtime-v2): serialize eventstream payload properly * chore(codegen): simplify the event playload writer interface
1 parent 06bf40e commit 757f883

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

clients/client-lex-runtime-v2/src/protocols/Aws_restJson1.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,8 @@ const serializeAws_restJson1AudioInputEvent_event = (input: AudioInputEvent, con
10401040
},
10411041
body: new Uint8Array(),
10421042
};
1043-
message.body = serializeAws_restJson1AudioInputEvent(input, context);
1043+
const body = serializeAws_restJson1AudioInputEvent(input, context);
1044+
message.body = context.utf8Decoder(JSON.stringify(body));
10441045
return message;
10451046
};
10461047
const serializeAws_restJson1ConfigurationEvent_event = (
@@ -1054,7 +1055,8 @@ const serializeAws_restJson1ConfigurationEvent_event = (
10541055
},
10551056
body: new Uint8Array(),
10561057
};
1057-
message.body = serializeAws_restJson1ConfigurationEvent(input, context);
1058+
const body = serializeAws_restJson1ConfigurationEvent(input, context);
1059+
message.body = context.utf8Decoder(JSON.stringify(body));
10581060
return message;
10591061
};
10601062
const serializeAws_restJson1DisconnectionEvent_event = (
@@ -1068,7 +1070,8 @@ const serializeAws_restJson1DisconnectionEvent_event = (
10681070
},
10691071
body: new Uint8Array(),
10701072
};
1071-
message.body = serializeAws_restJson1DisconnectionEvent(input, context);
1073+
const body = serializeAws_restJson1DisconnectionEvent(input, context);
1074+
message.body = context.utf8Decoder(JSON.stringify(body));
10721075
return message;
10731076
};
10741077
const serializeAws_restJson1DTMFInputEvent_event = (input: DTMFInputEvent, context: __SerdeContext): __Message => {
@@ -1079,7 +1082,8 @@ const serializeAws_restJson1DTMFInputEvent_event = (input: DTMFInputEvent, conte
10791082
},
10801083
body: new Uint8Array(),
10811084
};
1082-
message.body = serializeAws_restJson1DTMFInputEvent(input, context);
1085+
const body = serializeAws_restJson1DTMFInputEvent(input, context);
1086+
message.body = context.utf8Decoder(JSON.stringify(body));
10831087
return message;
10841088
};
10851089
const serializeAws_restJson1PlaybackCompletionEvent_event = (
@@ -1093,7 +1097,8 @@ const serializeAws_restJson1PlaybackCompletionEvent_event = (
10931097
},
10941098
body: new Uint8Array(),
10951099
};
1096-
message.body = serializeAws_restJson1PlaybackCompletionEvent(input, context);
1100+
const body = serializeAws_restJson1PlaybackCompletionEvent(input, context);
1101+
message.body = context.utf8Decoder(JSON.stringify(body));
10971102
return message;
10981103
};
10991104
const serializeAws_restJson1TextInputEvent_event = (input: TextInputEvent, context: __SerdeContext): __Message => {
@@ -1104,7 +1109,8 @@ const serializeAws_restJson1TextInputEvent_event = (input: TextInputEvent, conte
11041109
},
11051110
body: new Uint8Array(),
11061111
};
1107-
message.body = serializeAws_restJson1TextInputEvent(input, context);
1112+
const body = serializeAws_restJson1TextInputEvent(input, context);
1113+
message.body = context.utf8Decoder(JSON.stringify(body));
11081114
return message;
11091115
};
11101116
const deserializeAws_restJson1AccessDeniedException_event = async (

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ protected void serializeInputDocumentBody(
155155
serializeDocumentBody(context, documentBindings);
156156
}
157157

158+
@Override
159+
protected void serializeInputEventDocumentPayload(GenerationContext context) {
160+
TypeScriptWriter writer = context.getWriter();
161+
writer.write("message.body = context.utf8Decoder(body.toString());");
162+
}
163+
158164
@Override
159165
protected void serializeOutputDocumentBody(
160166
GenerationContext context,

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ protected void serializeInputPayload(
183183
serializePayload(context, payloadBinding);
184184
}
185185

186+
@Override
187+
protected void serializeInputEventDocumentPayload(GenerationContext context) {
188+
TypeScriptWriter writer = context.getWriter();
189+
writer.write("message.body = context.utf8Decoder(JSON.stringify(body));");
190+
}
191+
186192
@Override
187193
protected void serializeOutputPayload(
188194
GenerationContext context,

0 commit comments

Comments
 (0)