Skip to content

Commit e266432

Browse files
authored
refactor: remove suspend from deserialization (#417)
1 parent 3ba8e3d commit e266432

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/customization/glacier/GlacierAccountIdDefault.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private class GlacierAccountIdMiddleware : ProtocolMiddleware {
4747
val accountId = ctx.model.expectShape<StructureShape>(op.input.get()).members().first { it.memberName.lowercase() == "accountid" }
4848
writer.addImport(RuntimeTypes.Http.Operation.OperationRequest)
4949

50-
writer.withBlock("execution.initialize.intercept { req, next -> ", "}") {
50+
writer.withBlock("op.execution.initialize.intercept { req, next -> ", "}") {
5151
openBlock("if (req.subject.#L.isNullOrEmpty()) {", accountId.defaultName())
5252
.write("val updated = req.subject.copy { #L = #S }", accountId.defaultName(), "-")
5353
.write("next.call(#T(req.context, updated))", RuntimeTypes.Http.Operation.OperationRequest)

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/aws/sdk/kotlin/codegen/protocols/RestXml.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ open class RestXml : AwsHttpBindingProtocolGenerator() {
174174
// in two different contexts
175175
val boundMemberName = boundMember.capitalizedDefaultName()
176176
val deserializeLambdaIdent = "deserialize$boundMemberName"
177-
writer.withBlock("val $deserializeLambdaIdent = suspend {", "}") {
177+
writer.withBlock("val $deserializeLambdaIdent = {", "}") {
178178
write("val builder = #T.builder()", memberSymbol)
179179
renderDeserializerBody(ctx, copyWithMemberTraits, targetShape.members().toList(), writer)
180180
write("builder.build()")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ sdkVersion=0.9.3-SNAPSHOT
1212
smithyVersion=1.13.1
1313
smithyGradleVersion=0.5.3
1414
# smithy-kotlin codegen and runtime are versioned together
15-
smithyKotlinVersion=0.7.1-alpha
15+
smithyKotlinVersion=0.7.2-SNAPSHOT
1616

1717
# kotlin
1818
kotlinVersion=1.5.31

services/s3/common/src/aws/sdk/kotlin/services/s3/internal/GetBucketLocationOperationDeserializer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal class GetBucketLocationOperationDeserializer : HttpDeserialize<GetBucke
2828
}
2929
}
3030

31-
private suspend fun deserializeGetBucketLocationOperationBody(builder: GetBucketLocationResponse.DslBuilder, payload: ByteArray) {
31+
private fun deserializeGetBucketLocationOperationBody(builder: GetBucketLocationResponse.DslBuilder, payload: ByteArray) {
3232
val dom = parseDom(xmlStreamReader(payload))
3333
check(dom.name.local == "LocationConstraint") { "Expected top-level tag of 'LocationConstraint' but found ${dom.name}." }
3434
val rawLocationConstraint = checkNotNull(dom.text) { "Did not receive a value for 'LocationConstraint' in response." }

services/s3/common/src/aws/sdk/kotlin/services/s3/internal/S3ErrorMetadata.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal fun setS3ErrorMetadata(exception: Any, response: HttpResponse, errorDet
4141
}
4242
}
4343

44-
internal suspend fun parseS3ErrorResponse(payload: ByteArray): S3ErrorDetails {
44+
internal fun parseS3ErrorResponse(payload: ByteArray): S3ErrorDetails {
4545
val MESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("Message"))
4646
val CODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("Code"))
4747
val REQUESTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, XmlSerialName("RequestId"))

services/s3/common/test/aws/sdk/kotlin/services/s3/internal/S3ErrorMetadataTest.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
*/
55
package aws.sdk.kotlin.services.s3.internal
66

7-
import aws.sdk.kotlin.runtime.testing.runSuspendTest
87
import kotlin.test.*
98

109
class S3ErrorDeserializerTest {
1110

1211
@Test
13-
fun `it deserializes s3 errors`() = runSuspendTest {
12+
fun `it deserializes s3 errors`() {
1413
val payload = """
1514
<Error>
1615
<Type>Sender</Type>
@@ -31,7 +30,7 @@ class S3ErrorDeserializerTest {
3130
}
3231

3332
@Test
34-
fun `it partially deserializes s3 errors`() = runSuspendTest {
33+
fun `it partially deserializes s3 errors`() {
3534
val tests = listOf(
3635
"""
3736
<Error>

0 commit comments

Comments
 (0)