From 9f24ab4e75ece94a4b48345233cac673d77d708e Mon Sep 17 00:00:00 2001 From: Hunter Mellema <124718352+hpmellema@users.noreply.github.com> Date: Wed, 27 Nov 2024 09:07:51 -0700 Subject: [PATCH 01/13] Update README.md to use new logo (#1192) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ff20aa52..3d1a54aa4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Smithy Smithy Kotlin +# Smithy Smithy Kotlin [Smithy](https://smithy.io/2.0/index.html) code generators for [Kotlin](https://kotlinlang.org/). From 2895ea2861b4101533c55b2dd43a7c91572f8504 Mon Sep 17 00:00:00 2001 From: 0marperez <60363173+0marperez@users.noreply.github.com> Date: Mon, 2 Dec 2024 09:45:21 -0700 Subject: [PATCH 02/13] misc: override toString in business metrics (#1188) --- runtime/runtime-core/api/runtime-core.api | 1 + .../runtime/businessmetrics/BusinessMetricsUtils.kt | 3 +++ .../runtime/businessmetrics/BusinessMetricsUtilsTest.kt | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/runtime/runtime-core/api/runtime-core.api b/runtime/runtime-core/api/runtime-core.api index 237aac6f7..942f99e34 100644 --- a/runtime/runtime-core/api/runtime-core.api +++ b/runtime/runtime-core/api/runtime-core.api @@ -103,6 +103,7 @@ public final class aws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetri public static final field WAITER Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric; public static fun getEntries ()Lkotlin/enums/EnumEntries; public fun getIdentifier ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; public static fun valueOf (Ljava/lang/String;)Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric; public static fun values ()[Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric; } diff --git a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt index 774b0c9d9..fa9c41652 100644 --- a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt +++ b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt @@ -90,4 +90,7 @@ public enum class SmithyBusinessMetric(public override val identifier: String) : SERVICE_ENDPOINT_OVERRIDE("N"), ACCOUNT_ID_BASED_ENDPOINT("O"), SIGV4A_SIGNING("S"), + ; + + override fun toString(): String = identifier } diff --git a/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtilsTest.kt b/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtilsTest.kt index f5ff6ac72..308ec0e76 100644 --- a/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtilsTest.kt +++ b/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtilsTest.kt @@ -7,6 +7,7 @@ package aws.smithy.kotlin.runtime.businessmetrics import aws.smithy.kotlin.runtime.collections.get import aws.smithy.kotlin.runtime.operation.ExecutionContext import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue @@ -55,4 +56,12 @@ class BusinessMetricsUtilsTest { executionContext.removeBusinessMetric(SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION) assertFalse(executionContext.containsBusinessMetric(SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION)) } + + @Test + fun businessMetricToString() { + val businessMetricToString = SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION.toString() + val businessMetricIdentifier = SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION.identifier + + assertEquals(businessMetricIdentifier, businessMetricToString) + } } From fee329b3ff46c1449c4b7e5dabf039323faa484b Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Mon, 2 Dec 2024 16:57:37 +0000 Subject: [PATCH 03/13] chore: release 1.3.27 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d35f5ec5..cf4cfe401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## [1.3.27] - 12/02/2024 + ## [1.3.26] - 11/22/2024 ### Fixes diff --git a/gradle.properties b/gradle.properties index 6cb1d24c5..f7ad6373a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.27-SNAPSHOT +sdkVersion=1.3.27 # codegen -codegenVersion=0.33.27-SNAPSHOT \ No newline at end of file +codegenVersion=0.33.27 \ No newline at end of file From 6d2870f1b40012cdb9b0daaec9baf688c3250858 Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Mon, 2 Dec 2024 16:57:38 +0000 Subject: [PATCH 04/13] chore: bump snapshot version to 1.3.28-SNAPSHOT --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index f7ad6373a..5a98771ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.27 +sdkVersion=1.3.28-SNAPSHOT # codegen -codegenVersion=0.33.27 \ No newline at end of file +codegenVersion=0.33.28-SNAPSHOT \ No newline at end of file From aa05c62b60a15b3add00a99e5adb3e3ad8b162f2 Mon Sep 17 00:00:00 2001 From: 0marperez <60363173+0marperez@users.noreply.github.com> Date: Tue, 3 Dec 2024 13:16:06 -0700 Subject: [PATCH 05/13] misc: disable smoke test runner code generation (#1193) --- .../codegen/rendering/smoketests/SmokeTestsIntegration.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt index 192494e9e..9407c2911 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt @@ -5,8 +5,6 @@ import software.amazon.smithy.kotlin.codegen.core.CodegenContext import software.amazon.smithy.kotlin.codegen.core.DEFAULT_TEST_SOURCE_SET_ROOT import software.amazon.smithy.kotlin.codegen.core.KotlinDelegator import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration -import software.amazon.smithy.kotlin.codegen.model.hasTrait -import software.amazon.smithy.kotlin.codegen.utils.topDownOperations import software.amazon.smithy.model.Model import software.amazon.smithy.smoketests.traits.SmokeTestsTrait @@ -15,7 +13,9 @@ import software.amazon.smithy.smoketests.traits.SmokeTestsTrait */ class SmokeTestsIntegration : KotlinIntegration { override fun enabledForService(model: Model, settings: KotlinSettings): Boolean = - model.topDownOperations(settings.service).any { it.hasTrait() } + false + // FIXME: Enable smoke tests again + // model.topDownOperations(settings.service).any { it.hasTrait() } override fun writeAdditionalFiles(ctx: CodegenContext, delegator: KotlinDelegator) = delegator.useFileWriter( From b4ad1727b7b43958ac76f5e801e872a1f60d5a20 Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Tue, 3 Dec 2024 20:19:34 +0000 Subject: [PATCH 06/13] chore: release 1.3.28 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4cfe401..5aa0b4121 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## [1.3.28] - 12/03/2024 + ## [1.3.27] - 12/02/2024 ## [1.3.26] - 11/22/2024 diff --git a/gradle.properties b/gradle.properties index 5a98771ac..7068e8f2e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.28-SNAPSHOT +sdkVersion=1.3.28 # codegen -codegenVersion=0.33.28-SNAPSHOT \ No newline at end of file +codegenVersion=0.33.28 \ No newline at end of file From 394eb3b2f975b111e234da89fd901a250bc6faf2 Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Tue, 3 Dec 2024 20:19:35 +0000 Subject: [PATCH 07/13] chore: bump snapshot version to 1.3.29-SNAPSHOT --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7068e8f2e..8639149e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.28 +sdkVersion=1.3.29-SNAPSHOT # codegen -codegenVersion=0.33.28 \ No newline at end of file +codegenVersion=0.33.29-SNAPSHOT \ No newline at end of file From 8cbff710ce466134364b3f31d230f839365bde4b Mon Sep 17 00:00:00 2001 From: 0marperez <60363173+0marperez@users.noreply.github.com> Date: Thu, 12 Dec 2024 09:05:17 -0500 Subject: [PATCH 08/13] misc: enable smoke tests (#1194) --- .../smoketests/SmokeTestsIntegration.kt | 6 +++--- .../smoketests/SmokeTestsRunnerGenerator.kt | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt index 9407c2911..192494e9e 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsIntegration.kt @@ -5,6 +5,8 @@ import software.amazon.smithy.kotlin.codegen.core.CodegenContext import software.amazon.smithy.kotlin.codegen.core.DEFAULT_TEST_SOURCE_SET_ROOT import software.amazon.smithy.kotlin.codegen.core.KotlinDelegator import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration +import software.amazon.smithy.kotlin.codegen.model.hasTrait +import software.amazon.smithy.kotlin.codegen.utils.topDownOperations import software.amazon.smithy.model.Model import software.amazon.smithy.smoketests.traits.SmokeTestsTrait @@ -13,9 +15,7 @@ import software.amazon.smithy.smoketests.traits.SmokeTestsTrait */ class SmokeTestsIntegration : KotlinIntegration { override fun enabledForService(model: Model, settings: KotlinSettings): Boolean = - false - // FIXME: Enable smoke tests again - // model.topDownOperations(settings.service).any { it.hasTrait() } + model.topDownOperations(settings.service).any { it.hasTrait() } override fun writeAdditionalFiles(ctx: CodegenContext, delegator: KotlinDelegator) = delegator.useFileWriter( diff --git a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt index 81c275380..df8eeda53 100644 --- a/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt +++ b/codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt @@ -30,6 +30,7 @@ object SmokeTestSectionIds { object HttpEngineOverride : SectionId object ServiceFilter : SectionId object SkipTags : SectionId + object SmokeTestsFile : SectionId object ClientConfig : SectionId { val Name: SectionKey = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigName") val Value: SectionKey = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigValue") @@ -59,16 +60,18 @@ class SmokeTestsRunnerGenerator( ctx: CodegenContext, ) { internal fun render() { - writer.write("private var exitCode = 0") - renderEnvironmentVariables() - writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables) - writer.write("") - writer.withBlock("public suspend fun main() {", "}") { - renderFunctionCalls() - write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess) + writer.declareSection(SmokeTestSectionIds.SmokeTestsFile) { + writer.write("private var exitCode = 0") + renderEnvironmentVariables() + writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables) + writer.write("") + writer.withBlock("public suspend fun main() {", "}") { + renderFunctionCalls() + write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess) + } + writer.write("") + renderFunctions() } - writer.write("") - renderFunctions() } private fun renderEnvironmentVariables() { From ad2bdb9118af8b14dae1531abaa5ff08ae0b4cce Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Thu, 12 Dec 2024 14:22:59 +0000 Subject: [PATCH 09/13] chore: release 1.3.29 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5aa0b4121..892e2b124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## [1.3.29] - 12/12/2024 + ## [1.3.28] - 12/03/2024 ## [1.3.27] - 12/02/2024 diff --git a/gradle.properties b/gradle.properties index 8639149e0..42115b632 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.29-SNAPSHOT +sdkVersion=1.3.29 # codegen -codegenVersion=0.33.29-SNAPSHOT \ No newline at end of file +codegenVersion=0.33.29 \ No newline at end of file From 48860877aa79b7441f638ea13effe191342ef3d0 Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Thu, 12 Dec 2024 14:23:00 +0000 Subject: [PATCH 10/13] chore: bump snapshot version to 1.3.30-SNAPSHOT --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 42115b632..f35cfc1d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.29 +sdkVersion=1.3.30-SNAPSHOT # codegen -codegenVersion=0.33.29 \ No newline at end of file +codegenVersion=0.33.30-SNAPSHOT \ No newline at end of file From a4734c7551694dd90a71aa5d1e4818ec9ae7b47f Mon Sep 17 00:00:00 2001 From: 0marperez <60363173+0marperez@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:30:46 -0500 Subject: [PATCH 11/13] fix: create JMESPATH flattenIfPossible functions for Lists (#1169) --- .../smithy/kotlin/runtime/util/JMESPath.kt | 10 ++++ .../kotlin/runtime/util/JmesPathTest.kt | 49 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/JmesPathTest.kt diff --git a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/JMESPath.kt b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/JMESPath.kt index 2a7cdd979..9b691a79a 100644 --- a/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/JMESPath.kt +++ b/runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/JMESPath.kt @@ -66,6 +66,7 @@ public fun Any?.type(): String = when (this) { else -> throw Exception("Undetected type for: $this") } +// Collection `flattenIfPossible` functions @InternalApi @JvmName("noOpUnnestedCollection") public inline fun Collection.flattenIfPossible(): Collection = this @@ -73,3 +74,12 @@ public inline fun Collection.flattenIfPossible(): Collection = @InternalApi @JvmName("flattenNestedCollection") public inline fun Collection>.flattenIfPossible(): Collection = flatten() + +// List `flattenIfPossible` functions +@InternalApi +@JvmName("noOpUnnestedCollection") +public inline fun List.flattenIfPossible(): List = this + +@InternalApi +@JvmName("flattenNestedCollection") +public inline fun List>.flattenIfPossible(): List = flatten() diff --git a/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/JmesPathTest.kt b/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/JmesPathTest.kt new file mode 100644 index 000000000..e867f1e8a --- /dev/null +++ b/runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/JmesPathTest.kt @@ -0,0 +1,49 @@ +package aws.smithy.kotlin.runtime.util + +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class JmesPathTest { + @Test + fun flattenNestedLists() { + val nestedList = listOf( + listOf(1, 2, 3), + listOf(4, 5), + listOf(6), + ) + val flattenedList = nestedList.flattenIfPossible() + assertEquals(listOf(1, 2, 3, 4, 5, 6), flattenedList) + } + + @Test + fun flattenEmptyNestedLists() { + val nestedList = listOf( + listOf(), + listOf(), + listOf(), + ) + val flattenedList = nestedList.flattenIfPossible() + assertTrue(flattenedList.isEmpty()) + } + + @Test + fun flattenNestedEmptyAndNonEmptyNestedLists() { + val nestedList = listOf( + listOf(1, 2), + listOf(), + listOf(3, 4, 5), + ) + val flattenedList = nestedList.flattenIfPossible() + assertEquals(listOf(1, 2, 3, 4, 5), flattenedList) + } + + @Test + fun flattenList() { + val nestedList = listOf( + listOf(1, 2, 3), + ) + val flattenedList = nestedList.flattenIfPossible() + assertEquals(listOf(1, 2, 3), flattenedList) + } +} From 7911a94dd5f6ee27f2652aeb7c8031e2dce79215 Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Mon, 16 Dec 2024 16:51:49 +0000 Subject: [PATCH 12/13] chore: release 1.3.30 --- CHANGELOG.md | 2 ++ gradle.properties | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 892e2b124..5633a30d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## [1.3.30] - 12/16/2024 + ## [1.3.29] - 12/12/2024 ## [1.3.28] - 12/03/2024 diff --git a/gradle.properties b/gradle.properties index f35cfc1d5..377ff6666 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.30-SNAPSHOT +sdkVersion=1.3.30 # codegen -codegenVersion=0.33.30-SNAPSHOT \ No newline at end of file +codegenVersion=0.33.30 \ No newline at end of file From 7085c8ab0d4b34d3ddb77bbb31a2fd41c47c288c Mon Sep 17 00:00:00 2001 From: aws-sdk-kotlin-ci Date: Mon, 16 Dec 2024 16:51:50 +0000 Subject: [PATCH 13/13] chore: bump snapshot version to 1.3.31-SNAPSHOT --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 377ff6666..3628520e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # SDK -sdkVersion=1.3.30 +sdkVersion=1.3.31-SNAPSHOT # codegen -codegenVersion=0.33.30 \ No newline at end of file +codegenVersion=0.33.31-SNAPSHOT \ No newline at end of file