Skip to content

Commit b4ba0ad

Browse files
authored
chore: Update to Smithy 1.53.0 (#866)
1 parent de5a56e commit b4ba0ad

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kotlin.code.style=official
33
# config
44

55
# codegen
6-
smithyVersion=1.52.1
6+
smithyVersion=1.53.0
77
smithyGradleVersion=0.6.0
88

99
# kotlin

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/ShapeValueGenerator.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import software.amazon.smithy.model.traits.EnumTrait
2828
import software.amazon.smithy.model.traits.StreamingTrait
2929
import software.amazon.smithy.swift.codegen.model.hasTrait
3030
import software.amazon.smithy.swift.codegen.model.toMemberNames
31+
import software.amazon.smithy.swift.codegen.swiftmodules.FoundationTypes
3132
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyStreamsTypes
3233
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTimestampsTypes
3334
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTypes
@@ -160,11 +161,12 @@ class ShapeValueGenerator(
160161
}
161162
ShapeType.BLOB -> {
162163
if (shape.hasTrait<StreamingTrait>()) {
163-
writer.writeInline(".stream(\$N(data: ", SmithyStreamsTypes.Core.BufferedStream)
164-
".data(using: .utf8)!, isClosed: true))"
164+
writer.writeInline(".stream(\$N(data: \$N(", SmithyStreamsTypes.Core.BufferedStream, FoundationTypes.Data)
165+
".utf8), isClosed: true))"
165166
} else {
166167
// TODO: properly handle this optional with an unwrapped statement before it's passed as a value to a shape.
167-
".data(using: .utf8)!"
168+
writer.writeInline("\$N(", FoundationTypes.Data)
169+
".utf8)"
168170
}
169171
}
170172
else -> { "" }

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/SwiftSymbolProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,14 @@ class SwiftSymbolProvider(private val model: Model, val swiftSettings: SwiftSett
380380
if (shape.hasTrait<StreamingTrait>()) {
381381
{ writer ->
382382
writer.format(
383-
"\$N.data(\$N(\"$literal\".utf8))",
383+
"\$N.data(\$N(base64Encoded: \"$literal\"))",
384384
SmithyTypes.ByteStream,
385385
FoundationTypes.Data
386386
)
387387
}
388388
} else {
389389
{ writer ->
390-
writer.format("\$N(\"$literal\".utf8)", FoundationTypes.Data)
390+
writer.format("\$N(base64Encoded: \"$literal\")", FoundationTypes.Data)
391391
}
392392
}
393393
)

smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/serde/member/MemberShapeDecodeGenerator.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,16 @@ open class MemberShapeDecodeGenerator(
243243
writer.addImport(FoundationTypes.Data)
244244
return if (targetShape.hasTrait<StreamingTrait>()) {
245245
writer.format(
246-
" ?? \$N.data(\$N(\"$value\".utf8))",
246+
" ?? \$N.data(\$N(base64Encoded: \$S))",
247247
SmithyTypes.ByteStream,
248-
FoundationTypes.Data
248+
FoundationTypes.Data,
249+
value,
249250
)
250251
} else {
251252
writer.format(
252-
" ?? \$N(\"$value\".utf8)",
253-
FoundationTypes.Data
253+
" ?? \$N(base64Encoded: \$S)",
254+
FoundationTypes.Data,
255+
value,
254256
)
255257
}
256258
}

0 commit comments

Comments
 (0)