override fun generateSerializers()

in smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/HttpBindingProtocolGenerator.kt [121:168]


    override fun generateSerializers(ctx: ProtocolGenerator.GenerationContext) {
        // render conformance to HttpRequestBinding for all input shapes
        val inputShapesWithHttpBindings: MutableSet<ShapeId> = mutableSetOf()
        for (operation in getHttpBindingOperations(ctx)) {
            if (operation.input.isPresent) {
                val inputShapeId = operation.input.get()
                if (inputShapesWithHttpBindings.contains(inputShapeId)) {
                    // The input shape is referenced by more than one operation
                    continue
                }
                val httpBindingResolver = getProtocolHttpBindingResolver(ctx, defaultContentType)
                HttpUrlPathMiddleware.renderUrlPathMiddleware(ctx, operation, httpBindingResolver)
                HttpHeaderMiddleware.renderHeaderMiddleware(ctx, operation, httpBindingResolver, defaultTimestampFormat)
                HttpQueryItemMiddleware.renderQueryMiddleware(ctx, operation, httpBindingResolver, defaultTimestampFormat)
                HttpBodyMiddleware.renderBodyMiddleware(ctx, operation, httpBindingResolver)
                inputShapesWithHttpBindings.add(inputShapeId)
            }
        }

        val inputShapesWithMetadata = resolveInputShapes(ctx)
        for ((shape, shapeMetadata) in inputShapesWithMetadata) {
            val symbol: Symbol = ctx.symbolProvider.toSymbol(shape)
            val symbolName = symbol.name
            val rootNamespace = ctx.settings.moduleName
            val encodeSymbol = Symbol.builder()
                .definitionFile("./$rootNamespace/models/$symbolName+Encodable.swift")
                .name(symbolName)
                .build()

            ctx.delegator.useShapeWriter(encodeSymbol) { writer ->
                writer.openBlock("extension $symbolName: \$N, \$N {", "}", SwiftTypes.Protocols.Encodable, ClientRuntimeTypes.Core.Reflection) {
                    writer.addImport(SwiftDependency.CLIENT_RUNTIME.target)
                    val httpBodyMembers = shape.members()
                        .filter { it.isInHttpBody() }
                        .toList()
                    if (shouldRenderCodingKeysForEncodable) {
                        generateCodingKeysForMembers(ctx, writer, httpBodyMembers)
                        writer.write("")
                    }
                    renderStructEncode(ctx, shape, shapeMetadata, httpBodyMembers, writer, defaultTimestampFormat)
                }
            }
            if (shouldRenderDecodableBodyStructForInputShapes) {
                renderBodyStructAndDecodableExtension(ctx, shape, mapOf())
                DynamicNodeDecodingGeneratorStrategy(ctx, shape, isForBodyStruct = true).renderIfNeeded()
            }
        }
    }