Skip to content

Commit

Permalink
chore: Move struct encode/decode to HTTPBindingProtocolGenerator (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins authored May 16, 2024
1 parent 5bf61c2 commit 6b33576
Showing 1 changed file with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,18 @@ import software.amazon.smithy.aws.swift.codegen.middleware.UserAgentMiddleware
import software.amazon.smithy.codegen.core.Symbol
import software.amazon.smithy.model.shapes.MemberShape
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.shapes.Shape
import software.amazon.smithy.model.shapes.ShapeId
import software.amazon.smithy.model.shapes.UnionShape
import software.amazon.smithy.model.traits.TimestampFormatTrait
import software.amazon.smithy.rulesengine.language.EndpointRuleSet
import software.amazon.smithy.rulesengine.traits.EndpointRuleSetTrait
import software.amazon.smithy.rulesengine.traits.EndpointTestsTrait
import software.amazon.smithy.swift.codegen.SwiftWriter
import software.amazon.smithy.swift.codegen.integration.HTTPBindingProtocolGenerator
import software.amazon.smithy.swift.codegen.integration.HTTPProtocolCustomizable
import software.amazon.smithy.swift.codegen.integration.HttpProtocolTestGenerator
import software.amazon.smithy.swift.codegen.integration.HttpProtocolUnitTestErrorGenerator
import software.amazon.smithy.swift.codegen.integration.HttpProtocolUnitTestRequestGenerator
import software.amazon.smithy.swift.codegen.integration.HttpProtocolUnitTestResponseGenerator
import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator
import software.amazon.smithy.swift.codegen.integration.serde.struct.StructDecodeGenerator
import software.amazon.smithy.swift.codegen.integration.serde.struct.StructEncodeGenerator
import software.amazon.smithy.swift.codegen.model.ShapeMetadata
import software.amazon.smithy.swift.codegen.model.findStreamingMember
import software.amazon.smithy.swift.codegen.model.getTrait
import software.amazon.smithy.swift.codegen.model.isInputEventStream
Expand Down Expand Up @@ -87,30 +81,6 @@ abstract class AWSHTTPBindingProtocolGenerator(
return testCount
}

override fun renderStructEncode(
ctx: ProtocolGenerator.GenerationContext,
shapeContainingMembers: Shape,
shapeMetadata: Map<ShapeMetadata, Any>,
members: List<MemberShape>,
writer: SwiftWriter,
defaultTimestampFormat: TimestampFormatTrait.Format,
path: String?
) {
StructEncodeGenerator(ctx, shapeContainingMembers, members, shapeMetadata, writer).render()
}

override fun renderStructDecode(
ctx: ProtocolGenerator.GenerationContext,
shapeContainingMembers: Shape,
shapeMetaData: Map<ShapeMetadata, Any>,
members: List<MemberShape>,
writer: SwiftWriter,
defaultTimestampFormat: TimestampFormatTrait.Format,
path: String
) {
StructDecodeGenerator(ctx, shapeContainingMembers, members, shapeMetaData, writer).render()
}

override fun addProtocolSpecificMiddleware(ctx: ProtocolGenerator.GenerationContext, operation: OperationShape) {
operationMiddleware.appendMiddleware(operation, OperationEndpointResolverMiddleware(ctx))
operationMiddleware.appendMiddleware(operation, UserAgentMiddleware(ctx.settings))
Expand Down

0 comments on commit 6b33576

Please sign in to comment.