Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ abstract class AbstractQueryFormUrlSerializerGenerator(
return shape.documentSerializer(ctx.settings, symbol, members) { writer ->
writer.openBlock("internal fun #identifier.name:L(serializer: #T, input: #T) {", RuntimeTypes.Serde.Serializer, symbol)
.call {
renderSerializerBody(ctx, shape, shape.members().toList(), writer)
renderSerializerBody(ctx, shape, members.toList(), writer)
}
.closeBlock("}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package software.amazon.smithy.kotlin.codegen.aws.protocols

import io.kotest.matchers.string.shouldNotContain
import software.amazon.smithy.kotlin.codegen.test.*
import kotlin.test.Test

Expand Down Expand Up @@ -145,4 +146,20 @@ class RpcV2CborTest {
val serializeBody = serializer.lines(" override suspend fun serialize(context: ExecutionContext, input: PutFooStreamingRequest): HttpRequestBuilder {", "}")
serializeBody.shouldContainOnlyOnceWithDiff("""builder.headers.setMissing("Content-Type", "application/vnd.amazon.eventstream")""")
}

@Test
fun testEventStreamInitialRequestDoesNotSerializeStreamMember() {
val ctx = model.newTestContext("CborExample")

val generator = RpcV2Cbor()
generator.generateProtocolClient(ctx.generationCtx)

ctx.generationCtx.delegator.finalize()
ctx.generationCtx.delegator.flushWriters()

val documentSerializer = ctx.manifest.expectFileString("/src/main/kotlin/com/test/serde/PutFooStreamingRequestDocumentSerializer.kt")

val serializeBody = documentSerializer.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", "}")
serializeBody.shouldNotContain("input.messages") // `messages` is the stream member and should not be serialized in the initial request
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CborSerializerGenerator(
val symbol = ctx.symbolProvider.toSymbol(shape)
return shape.documentSerializer(ctx.settings, symbol, members) { writer ->
writer.withBlock("internal fun #identifier.name:L(serializer: #T, input: #T) {", "}", RuntimeTypes.Serde.Serializer, symbol) {
call { renderSerializerBody(ctx, shape, shape.members().toList(), writer) }
call { renderSerializerBody(ctx, shape, members.toList(), writer) }
}
}
}
Expand Down
Loading