Skip to content

Commit

Permalink
chore: Update to Smithy 1.53.0 (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins authored Dec 19, 2024
1 parent de5a56e commit b4ba0ad
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kotlin.code.style=official
# config

# codegen
smithyVersion=1.52.1
smithyVersion=1.53.0
smithyGradleVersion=0.6.0

# kotlin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import software.amazon.smithy.model.traits.EnumTrait
import software.amazon.smithy.model.traits.StreamingTrait
import software.amazon.smithy.swift.codegen.model.hasTrait
import software.amazon.smithy.swift.codegen.model.toMemberNames
import software.amazon.smithy.swift.codegen.swiftmodules.FoundationTypes
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyStreamsTypes
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTimestampsTypes
import software.amazon.smithy.swift.codegen.swiftmodules.SmithyTypes
Expand Down Expand Up @@ -160,11 +161,12 @@ class ShapeValueGenerator(
}
ShapeType.BLOB -> {
if (shape.hasTrait<StreamingTrait>()) {
writer.writeInline(".stream(\$N(data: ", SmithyStreamsTypes.Core.BufferedStream)
".data(using: .utf8)!, isClosed: true))"
writer.writeInline(".stream(\$N(data: \$N(", SmithyStreamsTypes.Core.BufferedStream, FoundationTypes.Data)
".utf8), isClosed: true))"
} else {
// TODO: properly handle this optional with an unwrapped statement before it's passed as a value to a shape.
".data(using: .utf8)!"
writer.writeInline("\$N(", FoundationTypes.Data)
".utf8)"
}
}
else -> { "" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,14 @@ class SwiftSymbolProvider(private val model: Model, val swiftSettings: SwiftSett
if (shape.hasTrait<StreamingTrait>()) {
{ writer ->
writer.format(
"\$N.data(\$N(\"$literal\".utf8))",
"\$N.data(\$N(base64Encoded: \"$literal\"))",
SmithyTypes.ByteStream,
FoundationTypes.Data
)
}
} else {
{ writer ->
writer.format("\$N(\"$literal\".utf8)", FoundationTypes.Data)
writer.format("\$N(base64Encoded: \"$literal\")", FoundationTypes.Data)
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,16 @@ open class MemberShapeDecodeGenerator(
writer.addImport(FoundationTypes.Data)
return if (targetShape.hasTrait<StreamingTrait>()) {
writer.format(
" ?? \$N.data(\$N(\"$value\".utf8))",
" ?? \$N.data(\$N(base64Encoded: \$S))",
SmithyTypes.ByteStream,
FoundationTypes.Data
FoundationTypes.Data,
value,
)
} else {
writer.format(
" ?? \$N(\"$value\".utf8)",
FoundationTypes.Data
" ?? \$N(base64Encoded: \$S)",
FoundationTypes.Data,
value,
)
}
}
Expand Down

0 comments on commit b4ba0ad

Please sign in to comment.