Skip to content

Commit

Permalink
fix: Correct serde for restJson1 event streams that contain errors (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins authored Oct 2, 2023
1 parent 56298ea commit c0fa0e4
Show file tree
Hide file tree
Showing 7 changed files with 4,465 additions and 6 deletions.
1,163 changes: 1,163 additions & 0 deletions codegen/sdk-codegen/aws-models/bedrock-runtime.2023-09-30.json

Large diffs are not rendered by default.

3,294 changes: 3,294 additions & 0 deletions codegen/sdk-codegen/aws-models/bedrock.2023-04-20.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ abstract class AWSHttpBindingProtocolGenerator : HttpBindingProtocolGenerator()
members: List<MemberShape>,
writer: SwiftWriter,
defaultTimestampFormat: TimestampFormatTrait.Format,
path: String
path: String?
) {
val encodeGenerator = StructEncodeGenerator(ctx, members, writer, defaultTimestampFormat)
val encodeGenerator = StructEncodeGenerator(ctx, members, writer, defaultTimestampFormat, path)
encodeGenerator.render()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class MessageUnmarshallableGenerator(val ctx: ProtocolGenerator.GenerationContex
streamShape.eventStreamErrors(ctx.model).forEach { member ->
writer.write("case \"${member.memberName}\":")
writer.indent {
writer.write("return try decoder.decode(responseBody: message.payload) as ${member.memberName}")
val targetShape = ctx.model.expectShape(member.target)
val symbol = ctx.symbolProvider.toSymbol(targetShape)
writer.write("return try decoder.decode(responseBody: message.payload) as \$N", symbol)
}
}
writer.write("default:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() {
members: List<MemberShape>,
writer: SwiftWriter,
defaultTimestampFormat: TimestampFormatTrait.Format,
path: String
path: String?
) {
val customizations = AwsQueryFormURLEncodeCustomizations()
val encoder = StructEncodeFormURLGenerator(ctx, customizations, shapeContainingMembers, shapeMetadata, members, writer, defaultTimestampFormat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() {
members: List<MemberShape>,
writer: SwiftWriter,
defaultTimestampFormat: TimestampFormatTrait.Format,
path: String
path: String?
) {
val customizations = Ec2QueryFormURLEncodeCustomizations()
val encoder = StructEncodeFormURLGenerator(ctx, customizations, shapeContainingMembers, shapeMetadata, members, writer, defaultTimestampFormat)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() {
members: List<MemberShape>,
writer: SwiftWriter,
defaultTimestampFormat: TimestampFormatTrait.Format,
path: String
path: String?
) {
val encoder = StructEncodeXMLGenerator(ctx, shapeContainingMembers, members, writer, defaultTimestampFormat)
encoder.render()
Expand Down

0 comments on commit c0fa0e4

Please sign in to comment.