Skip to content

Commit 652da19

Browse files
committed
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into v1.4
2 parents 869fb84 + 7085c8a commit 652da19

File tree

9 files changed

+95
-12
lines changed

9 files changed

+95
-12
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [1.3.30] - 12/16/2024
4+
5+
## [1.3.29] - 12/12/2024
6+
7+
## [1.3.28] - 12/03/2024
8+
9+
## [1.3.27] - 12/02/2024
10+
311
## [1.3.26] - 11/22/2024
412

513
### Fixes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <img alt="Smithy" src="https://github.com/smithy-lang/smithy/blob/main/docs/_static/favicon.png?raw=true" width="28"> Smithy Kotlin
1+
# <img alt="Smithy" src="https://github.com/smithy-lang/smithy/blob/main/docs/_static/smithy-anvil.svg?raw=true" width="32"> Smithy Kotlin
22

33
[Smithy](https://smithy.io/2.0/index.html) code generators for [Kotlin](https://kotlinlang.org/).
44

codegen/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/rendering/smoketests/SmokeTestsRunnerGenerator.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ object SmokeTestSectionIds {
3030
object HttpEngineOverride : SectionId
3131
object ServiceFilter : SectionId
3232
object SkipTags : SectionId
33+
object SmokeTestsFile : SectionId
3334
object ClientConfig : SectionId {
3435
val Name: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigName")
3536
val Value: SectionKey<String> = SectionKey("aws.smithy.kotlin#SmokeTestClientConfigValue")
@@ -59,16 +60,18 @@ class SmokeTestsRunnerGenerator(
5960
ctx: CodegenContext,
6061
) {
6162
internal fun render() {
62-
writer.write("private var exitCode = 0")
63-
renderEnvironmentVariables()
64-
writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables)
65-
writer.write("")
66-
writer.withBlock("public suspend fun main() {", "}") {
67-
renderFunctionCalls()
68-
write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess)
63+
writer.declareSection(SmokeTestSectionIds.SmokeTestsFile) {
64+
writer.write("private var exitCode = 0")
65+
renderEnvironmentVariables()
66+
writer.declareSection(SmokeTestSectionIds.AdditionalEnvironmentVariables)
67+
writer.write("")
68+
writer.withBlock("public suspend fun main() {", "}") {
69+
renderFunctionCalls()
70+
write("#T(exitCode)", RuntimeTypes.Core.SmokeTests.exitProcess)
71+
}
72+
writer.write("")
73+
renderFunctions()
6974
}
70-
writer.write("")
71-
renderFunctions()
7275
}
7376

7477
private fun renderEnvironmentVariables() {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ kotlinx.atomicfu.enableNativeIrTransformation=false
1313
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
1414

1515
# SDK
16-
sdkVersion=1.3.27-SNAPSHOT
16+
sdkVersion=1.3.31-SNAPSHOT
1717

1818
# codegen
19-
codegenVersion=0.33.27-SNAPSHOT
19+
codegenVersion=0.33.31-SNAPSHOT

runtime/runtime-core/api/runtime-core.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public final class aws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetri
103103
public static final field WAITER Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
104104
public static fun getEntries ()Lkotlin/enums/EnumEntries;
105105
public fun getIdentifier ()Ljava/lang/String;
106+
public fun toString ()Ljava/lang/String;
106107
public static fun valueOf (Ljava/lang/String;)Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
107108
public static fun values ()[Laws/smithy/kotlin/runtime/businessmetrics/SmithyBusinessMetric;
108109
}

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,7 @@ public enum class SmithyBusinessMetric(public override val identifier: String) :
9090
SERVICE_ENDPOINT_OVERRIDE("N"),
9191
ACCOUNT_ID_BASED_ENDPOINT("O"),
9292
SIGV4A_SIGNING("S"),
93+
;
94+
95+
override fun toString(): String = identifier
9396
}

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/util/JMESPath.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,20 @@ public fun Any?.type(): String = when (this) {
6666
else -> throw Exception("Undetected type for: $this")
6767
}
6868

69+
// Collection `flattenIfPossible` functions
6970
@InternalApi
7071
@JvmName("noOpUnnestedCollection")
7172
public inline fun <reified T> Collection<T>.flattenIfPossible(): Collection<T> = this
7273

7374
@InternalApi
7475
@JvmName("flattenNestedCollection")
7576
public inline fun <reified T> Collection<Collection<T>>.flattenIfPossible(): Collection<T> = flatten()
77+
78+
// List `flattenIfPossible` functions
79+
@InternalApi
80+
@JvmName("noOpUnnestedCollection")
81+
public inline fun <reified T> List<T>.flattenIfPossible(): List<T> = this
82+
83+
@InternalApi
84+
@JvmName("flattenNestedCollection")
85+
public inline fun <reified T> List<List<T>>.flattenIfPossible(): List<T> = flatten()

runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtilsTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package aws.smithy.kotlin.runtime.businessmetrics
77
import aws.smithy.kotlin.runtime.collections.get
88
import aws.smithy.kotlin.runtime.operation.ExecutionContext
99
import kotlin.test.Test
10+
import kotlin.test.assertEquals
1011
import kotlin.test.assertFalse
1112
import kotlin.test.assertTrue
1213

@@ -55,4 +56,12 @@ class BusinessMetricsUtilsTest {
5556
executionContext.removeBusinessMetric(SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION)
5657
assertFalse(executionContext.containsBusinessMetric(SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION))
5758
}
59+
60+
@Test
61+
fun businessMetricToString() {
62+
val businessMetricToString = SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION.toString()
63+
val businessMetricIdentifier = SmithyBusinessMetric.GZIP_REQUEST_COMPRESSION.identifier
64+
65+
assertEquals(businessMetricIdentifier, businessMetricToString)
66+
}
5867
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package aws.smithy.kotlin.runtime.util
2+
3+
import kotlin.test.Test
4+
import kotlin.test.assertEquals
5+
import kotlin.test.assertTrue
6+
7+
class JmesPathTest {
8+
@Test
9+
fun flattenNestedLists() {
10+
val nestedList = listOf(
11+
listOf(1, 2, 3),
12+
listOf(4, 5),
13+
listOf(6),
14+
)
15+
val flattenedList = nestedList.flattenIfPossible()
16+
assertEquals(listOf(1, 2, 3, 4, 5, 6), flattenedList)
17+
}
18+
19+
@Test
20+
fun flattenEmptyNestedLists() {
21+
val nestedList = listOf(
22+
listOf<Int>(),
23+
listOf(),
24+
listOf(),
25+
)
26+
val flattenedList = nestedList.flattenIfPossible()
27+
assertTrue(flattenedList.isEmpty())
28+
}
29+
30+
@Test
31+
fun flattenNestedEmptyAndNonEmptyNestedLists() {
32+
val nestedList = listOf(
33+
listOf(1, 2),
34+
listOf(),
35+
listOf(3, 4, 5),
36+
)
37+
val flattenedList = nestedList.flattenIfPossible()
38+
assertEquals(listOf(1, 2, 3, 4, 5), flattenedList)
39+
}
40+
41+
@Test
42+
fun flattenList() {
43+
val nestedList = listOf(
44+
listOf(1, 2, 3),
45+
)
46+
val flattenedList = nestedList.flattenIfPossible()
47+
assertEquals(listOf(1, 2, 3), flattenedList)
48+
}
49+
}

0 commit comments

Comments
 (0)