Skip to content

Commit 9673ed5

Browse files
committed
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-main-merge
2 parents 31412d2 + 0a29a00 commit 9673ed5

File tree

56 files changed

+1467
-210
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1467
-210
lines changed

.brazil.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"com.squareup.okhttp3:okhttp:5.*": "OkHttp3-5.x",
77
"com.squareup.okio:okio-jvm:3.*": "OkioJvm-3.x",
88
"io.opentelemetry:opentelemetry-api:1.*": "Maven-io-opentelemetry_opentelemetry-api-1.x",
9+
"io.opentelemetry:opentelemetry-extension-kotlin:1.*": "Maven-io-opentelemetry_opentelemetry-extension-kotlin-1.x",
910
"org.slf4j:slf4j-api:2.*": "Maven-org-slf4j_slf4j-api-2.x",
1011
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.9.*": "AwsCrtKotlin-0.9.x",
1112
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.8.*": "AwsCrtKotlin-0.8.x",

.github/workflows/merge-main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Merge main
2+
on:
3+
schedule:
4+
- cron: "0 7 * * 1-5" # At 07:00 UTC (00:00 PST, 03:00 EST), Monday through Friday
5+
workflow_dispatch:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Merge main
12+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/merge-main@main
13+
with:
14+
exempt-branches: # Add any if required

CHANGELOG.md

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

3+
## [1.4.11] - 03/14/2025
4+
5+
## [1.4.10] - 03/06/2025
6+
7+
### Fixes
8+
* Correctly handle sequential calls to `SingleFlightGroup`
9+
10+
## [1.4.9] - 02/27/2025
11+
12+
### Fixes
13+
* Correctly generate paginators for item type names which collide with other used types (e.g., an item type `com.foo.Flow` which conflicts with `kotlinx.coroutines.flow.Flow`)
14+
15+
## [1.4.8] - 02/27/2025
16+
17+
### Fixes
18+
* Idempotency tokens are no longer code-generated for nested structures. See: https://smithy.io/2.0/spec/behavior-traits.html#smithy-api-idempotencytoken-trait
19+
20+
## [1.4.7] - 02/25/2025
21+
22+
### Fixes
23+
* [#1211](https://github.com/smithy-lang/smithy-kotlin/issues/1211) Fix OpenTelemetry span concurrency by using Span.asContextElement() instead of Span.makeCurrent()
24+
25+
## [1.4.6] - 02/25/2025
26+
27+
## [1.4.5] - 02/24/2025
28+
29+
### Features
30+
* Add SigV4a support to the default AWS signer
31+
32+
## [1.4.4] - 02/18/2025
33+
34+
### Miscellaneous
35+
* Increase maximum event stream message length to 24MB
36+
37+
## [1.4.3] - 02/13/2025
38+
39+
### Fixes
40+
* Fix errors in equality checks for `CaseInsensitiveMap` which affect `Headers` and `ValuesMap` implementations
41+
* fix: correct hash code calculation for case-insensitive map entries
42+
* [#1413](https://github.com/awslabs/aws-sdk-kotlin/issues/1413) Favor `endpointUrl` over endpoint discovery when provided
43+
44+
### Miscellaneous
45+
* Add telemetry provider configuration to `DefaultAwsSigner`
46+
347
## [1.4.2] - 01/28/2025
448

549
### Fixes
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
package software.amazon.smithy.kotlin.codegen.aws.protocols
2+
3+
import software.amazon.smithy.kotlin.codegen.test.*
4+
import kotlin.test.Test
5+
6+
class AwsQueryTest {
7+
@Test
8+
fun testNonNestedIdempotencyToken() {
9+
val ctx = model.newTestContext("Example")
10+
11+
val generator = AwsQuery()
12+
generator.generateProtocolClient(ctx.generationCtx)
13+
14+
ctx.generationCtx.delegator.finalize()
15+
ctx.generationCtx.delegator.flushWriters()
16+
17+
val expected = """
18+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
19+
input.bar?.let { field(BAR_DESCRIPTOR, it) } ?: field(BAR_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
20+
}
21+
""".trimIndent()
22+
23+
val actual = ctx
24+
.manifest
25+
.expectFileString("/src/main/kotlin/com/test/serde/GetBarUnNestedOperationSerializer.kt")
26+
.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", " }")
27+
.trimIndent()
28+
29+
actual.shouldContainOnlyOnceWithDiff(expected)
30+
}
31+
32+
@Test
33+
fun testNestedIdempotencyToken() {
34+
val ctx = model.newTestContext("Example")
35+
36+
val generator = AwsQuery()
37+
generator.generateProtocolClient(ctx.generationCtx)
38+
39+
ctx.generationCtx.delegator.finalize()
40+
ctx.generationCtx.delegator.flushWriters()
41+
42+
val expected = """
43+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
44+
input.baz?.let { field(BAZ_DESCRIPTOR, it) }
45+
}
46+
""".trimIndent()
47+
48+
val actual = ctx
49+
.manifest
50+
.expectFileString("/src/main/kotlin/com/test/serde/NestDocumentSerializer.kt")
51+
.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", " }")
52+
.trimIndent()
53+
54+
actual.shouldContainOnlyOnceWithDiff(expected)
55+
56+
val unexpected = """
57+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
58+
input.baz?.let { field(BAZ_DESCRIPTOR, it) } ?: field(BAR_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
59+
}
60+
""".trimIndent()
61+
62+
actual.shouldNotContainOnlyOnceWithDiff(unexpected)
63+
}
64+
65+
private val model = """
66+
${"$"}version: "2"
67+
68+
namespace com.test
69+
70+
use aws.protocols#awsQuery
71+
use aws.api#service
72+
73+
@awsQuery
74+
@service(sdkId: "Example")
75+
@xmlNamespace(uri: "http://foo.com")
76+
service Example {
77+
version: "1.0.0",
78+
operations: [GetBarUnNested, GetBarNested]
79+
}
80+
81+
@http(method: "POST", uri: "/get-bar-un-nested")
82+
operation GetBarUnNested {
83+
input: BarUnNested
84+
}
85+
86+
structure BarUnNested {
87+
@idempotencyToken
88+
bar: String
89+
}
90+
91+
@http(method: "POST", uri: "/get-bar-nested")
92+
operation GetBarNested {
93+
input: BarNested
94+
}
95+
96+
structure BarNested {
97+
bar: Nest
98+
}
99+
100+
structure Nest {
101+
@idempotencyToken
102+
baz: String
103+
}
104+
""".toSmithyModel()
105+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package software.amazon.smithy.kotlin.codegen.aws.protocols
2+
3+
import software.amazon.smithy.kotlin.codegen.test.*
4+
import kotlin.test.Test
5+
6+
class RestJson1Test {
7+
@Test
8+
fun testNonNestedIdempotencyToken() {
9+
val ctx = model.newTestContext("Example")
10+
11+
val generator = RestJson1()
12+
generator.generateProtocolClient(ctx.generationCtx)
13+
14+
ctx.generationCtx.delegator.finalize()
15+
ctx.generationCtx.delegator.flushWriters()
16+
17+
val expected = """
18+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
19+
input.bar?.let { field(BAR_DESCRIPTOR, it) } ?: field(BAR_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
20+
}
21+
""".trimIndent()
22+
23+
val actual = ctx
24+
.manifest
25+
.expectFileString("/src/main/kotlin/com/test/serde/GetBarUnNestedOperationSerializer.kt")
26+
.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", " }")
27+
.trimIndent()
28+
29+
actual.shouldContainOnlyOnceWithDiff(expected)
30+
}
31+
32+
@Test
33+
fun testNestedIdempotencyToken() {
34+
val ctx = model.newTestContext("Example")
35+
36+
val generator = RestJson1()
37+
generator.generateProtocolClient(ctx.generationCtx)
38+
39+
ctx.generationCtx.delegator.finalize()
40+
ctx.generationCtx.delegator.flushWriters()
41+
42+
val expected = """
43+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
44+
input.baz?.let { field(BAZ_DESCRIPTOR, it) }
45+
}
46+
""".trimIndent()
47+
48+
val actual = ctx
49+
.manifest
50+
.expectFileString("/src/main/kotlin/com/test/serde/NestDocumentSerializer.kt")
51+
.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", " }")
52+
.trimIndent()
53+
54+
actual.shouldContainOnlyOnceWithDiff(expected)
55+
56+
val unexpected = """
57+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
58+
input.baz?.let { field(BAZ_DESCRIPTOR, it) } ?: field(BAR_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
59+
}
60+
""".trimIndent()
61+
62+
actual.shouldNotContainOnlyOnceWithDiff(unexpected)
63+
}
64+
65+
private val model = """
66+
${"$"}version: "2"
67+
68+
namespace com.test
69+
70+
use aws.protocols#restJson1
71+
use aws.api#service
72+
73+
@restJson1
74+
@service(sdkId: "Example")
75+
service Example {
76+
version: "1.0.0",
77+
operations: [GetBarUnNested, GetBarNested]
78+
}
79+
80+
@http(method: "POST", uri: "/get-bar-un-nested")
81+
operation GetBarUnNested {
82+
input: BarUnNested
83+
}
84+
85+
structure BarUnNested {
86+
@idempotencyToken
87+
bar: String
88+
}
89+
90+
@http(method: "POST", uri: "/get-bar-nested")
91+
operation GetBarNested {
92+
input: BarNested
93+
}
94+
95+
structure BarNested {
96+
bar: Nest
97+
}
98+
99+
structure Nest {
100+
@idempotencyToken
101+
baz: String
102+
}
103+
""".toSmithyModel()
104+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package software.amazon.smithy.kotlin.codegen.aws.protocols
2+
3+
import software.amazon.smithy.kotlin.codegen.test.*
4+
import kotlin.test.Test
5+
6+
class RestXmlTest {
7+
@Test
8+
fun testNonNestedIdempotencyToken() {
9+
val ctx = model.newTestContext("Example")
10+
11+
val generator = RestXml()
12+
generator.generateProtocolClient(ctx.generationCtx)
13+
14+
ctx.generationCtx.delegator.finalize()
15+
ctx.generationCtx.delegator.flushWriters()
16+
17+
val expected = """
18+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
19+
input.bar?.let { field(BAR_DESCRIPTOR, it) } ?: field(BAR_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
20+
}
21+
""".trimIndent()
22+
23+
val actual = ctx
24+
.manifest
25+
.expectFileString("/src/main/kotlin/com/test/serde/GetBarUnNestedOperationSerializer.kt")
26+
.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", " }")
27+
.trimIndent()
28+
29+
actual.shouldContainOnlyOnceWithDiff(expected)
30+
}
31+
32+
@Test
33+
fun testNestedIdempotencyToken() {
34+
val ctx = model.newTestContext("Example")
35+
36+
val generator = RestXml()
37+
generator.generateProtocolClient(ctx.generationCtx)
38+
39+
ctx.generationCtx.delegator.finalize()
40+
ctx.generationCtx.delegator.flushWriters()
41+
42+
val expected = """
43+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
44+
input.baz?.let { field(BAZ_DESCRIPTOR, it) }
45+
}
46+
""".trimIndent()
47+
48+
val actual = ctx
49+
.manifest
50+
.expectFileString("/src/main/kotlin/com/test/serde/NestDocumentSerializer.kt")
51+
.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", " }")
52+
.trimIndent()
53+
54+
actual.shouldContainOnlyOnceWithDiff(expected)
55+
56+
val unexpected = """
57+
serializer.serializeStruct(OBJ_DESCRIPTOR) {
58+
input.baz?.let { field(BAZ_DESCRIPTOR, it) } ?: field(BAR_DESCRIPTOR, context.idempotencyTokenProvider.generateToken())
59+
}
60+
""".trimIndent()
61+
62+
actual.shouldNotContainOnlyOnceWithDiff(unexpected)
63+
}
64+
65+
private val model = """
66+
${"$"}version: "2"
67+
68+
namespace com.test
69+
70+
use aws.protocols#restXml
71+
use aws.api#service
72+
73+
@restXml
74+
@service(sdkId: "Example")
75+
service Example {
76+
version: "1.0.0",
77+
operations: [GetBarUnNested, GetBarNested]
78+
}
79+
80+
@http(method: "POST", uri: "/get-bar-un-nested")
81+
operation GetBarUnNested {
82+
input: BarUnNested
83+
}
84+
85+
structure BarUnNested {
86+
@idempotencyToken
87+
bar: String
88+
}
89+
90+
@http(method: "POST", uri: "/get-bar-nested")
91+
operation GetBarNested {
92+
input: BarNested
93+
}
94+
95+
structure BarNested {
96+
bar: Nest
97+
}
98+
99+
structure Nest {
100+
@idempotencyToken
101+
baz: String
102+
}
103+
""".toSmithyModel()
104+
}

0 commit comments

Comments
 (0)