Skip to content

Commit

Permalink
chore: upgrade Smithy to 1.50.0 (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbotsf committed Jul 9, 2024
1 parent ea91fcd commit fcbe761
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/56c3bdfe-3416-46c4-a9e4-7d87918ee94b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "56c3bdfe-3416-46c4-a9e4-7d87918ee94b",
"type": "misc",
"description": "Upgrade Smithy to version **1.50.0**"
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ abstract class AwsHttpBindingProtocolGenerator : HttpBindingProtocolGenerator()

val ignoredTests = TestMemberDelta(
setOf(
// This test requires populating blob members with a default value of "", which the sdk doesn't do
"AwsJson10ClientPopulatesDefaultValuesInInput",
// Test broken in Smithy 1.50.0, should be fixed by https://github.com/smithy-lang/smithy/pull/2341
"RestJsonClientIgnoresDefaultValuesIfMemberValuesArePresentInResponse",
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class KotlinSymbolProvider(private val model: Model, private val settings: Kotli
private fun DefaultTrait.getDefaultValue(targetShape: Shape): String? {
val node = toNode()
return when {
node.toString() == "null" || targetShape is BlobShape && node.toString() == "" -> null
node.toString() == "null" -> null

// Check if target is an enum before treating the default like a regular number/string
targetShape.isEnum -> {
Expand All @@ -235,7 +235,14 @@ class KotlinSymbolProvider(private val model: Model, private val settings: Kotli
"${enumSymbol.fullName}.fromValue($arg)"
}

targetShape.isBlobShape && targetShape.isStreaming ->
node
.toString()
.takeUnless { it.isEmpty() }
?.let { "ByteStream.fromString(${it.dq()})" }

targetShape.isBlobShape -> "${node.toString().dq()}.encodeToByteArray()"

targetShape.isDocumentShape -> getDefaultValueForDocument(node)
targetShape.isTimestampShape -> getDefaultValueForTimestamp(node.asNumberNode().get())

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ slf4j-v1x-version = "1.7.36"
crt-kotlin-version = "0.8.6"

# codegen
smithy-version = "1.49.0"
smithy-version = "1.50.0"
smithy-gradle-version = "0.9.0"

# testing
Expand Down

0 comments on commit fcbe761

Please sign in to comment.