Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a4734c7
fix: create JMESPATH flattenIfPossible functions for Lists (#1169)
0marperez Dec 16, 2024
7911a94
chore: release 1.3.30
aws-sdk-kotlin-ci Dec 16, 2024
7085c8a
chore: bump snapshot version to 1.3.31-SNAPSHOT
aws-sdk-kotlin-ci Dec 16, 2024
4575023
misc: enhance support for replayable instances of `InputStream` (#1197)
lauzadis Dec 18, 2024
b0a4bac
chore: release 1.3.31
aws-sdk-kotlin-ci Dec 18, 2024
80f4538
chore: bump snapshot version to 1.3.32-SNAPSHOT
aws-sdk-kotlin-ci Dec 18, 2024
e9d16a9
fix: CBOR protocol test assertions / blob serialization (#1198)
lauzadis Dec 18, 2024
48849a1
fix: correctly serialize subset of shape's members when configured (#…
lauzadis Jan 6, 2025
ded3a4b
chore: release 1.3.32
aws-sdk-kotlin-ci Jan 6, 2025
d97e8ba
chore: bump snapshot version to 1.3.33-SNAPSHOT
aws-sdk-kotlin-ci Jan 6, 2025
78f17f3
chore: add *-main to branch workflows (#1209)
ianbotsf Jan 8, 2025
d06ee0a
chore: add .kotlin/ to .gitignore (#1208)
ianbotsf Jan 8, 2025
32c2b7f
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-main
lauzadis Jan 9, 2025
59397d7
Set aws.kotlin.native=false in verify-transform CI
lauzadis Jan 9, 2025
93e71b3
Set aws.kotlin.native=false in artifact-size-metrics CI
lauzadis Jan 9, 2025
55638e2
Set aws.kotlin.native=false in artifact-size-metrics CI
lauzadis Jan 9, 2025
d2e7c91
chore: smithy version bump (#1213)
0marperez Jan 10, 2025
5a2df8f
chore: release 1.3.33
aws-sdk-kotlin-ci Jan 10, 2025
003633b
chore: bump snapshot version to 1.3.34-SNAPSHOT
aws-sdk-kotlin-ci Jan 10, 2025
5f5ec8f
feat: add `AuthTokenGenerator` (#1212)
lauzadis Jan 10, 2025
3fe1b5e
chore: release 1.3.34
aws-sdk-kotlin-ci Jan 10, 2025
0bba308
chore: bump snapshot version to 1.3.35-SNAPSHOT
aws-sdk-kotlin-ci Jan 10, 2025
5633899
Add another -Paws.kotlin.native=false
lauzadis Jan 10, 2025
cadfb24
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-m…
lauzadis Jan 10, 2025
5aab402
Run the setup-build step
lauzadis Jan 10, 2025
274173d
Disable cross compile, only need to build JVM
lauzadis Jan 10, 2025
f3daf2a
Disable cross compile, only need to build JVM
lauzadis Jan 10, 2025
927aa29
Remove duplicate "Configure JDK" step
lauzadis Jan 10, 2025
cebdd36
Remove build step
lauzadis Jan 10, 2025
81d7e6a
aws.kotlin.native=false
lauzadis Jan 10, 2025
52e4439
misc: merge v1.4 into main (#1218)
0marperez Jan 15, 2025
e0c25d6
feat: support default checksums (#1191)
0marperez Jan 15, 2025
14e0958
chore: release 1.4.0
aws-sdk-kotlin-ci Jan 15, 2025
ed95d7b
chore: bump snapshot version to 1.4.1-SNAPSHOT
aws-sdk-kotlin-ci Jan 15, 2025
a4ace35
fix: add 0.9.x aws-crt-kotlin transform (#1220)
lauzadis Jan 16, 2025
15e5f0c
fix: Ensure `Host` header is included when signing auth tokens (#1222)
lauzadis Jan 16, 2025
447ac10
chore: release 1.4.1
aws-sdk-kotlin-ci Jan 16, 2025
0f8db44
chore: bump snapshot version to 1.4.2-SNAPSHOT
aws-sdk-kotlin-ci Jan 16, 2025
2176c02
Merge branch 'kn-main' of github.com:smithy-lang/smithy-kotlin into k…
lauzadis Jan 21, 2025
9d7c834
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-main
lauzadis Jan 21, 2025
f0fd110
Merge branch 'kn-main' into kn-merge
lauzadis Jan 21, 2025
2dc5d1c
Bump to latest build plugin
lauzadis Jan 21, 2025
5c03194
@IgnoreNative new tests
lauzadis Jan 21, 2025
f69cab1
disableCrossCompile on apiCheck
lauzadis Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .brazil.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"dependencies": {
"org.jetbrains.kotlin:kotlin-stdlib:2.0.*": "KotlinStdlib-2.x",
"org.jetbrains.kotlin:kotlin-stdlib:2.*": "KotlinStdlib-2.x",
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x",

"com.squareup.okhttp3:okhttp-coroutines:5.*": "OkHttp3Coroutines-5.x",
"com.squareup.okhttp3:okhttp:5.*": "OkHttp3-5.x",
"com.squareup.okio:okio-jvm:3.*": "OkioJvm-3.x",
"io.opentelemetry:opentelemetry-api:1.*": "Maven-io-opentelemetry_opentelemetry-api-1.x",
"org.slf4j:slf4j-api:2.*": "Maven-org-slf4j_slf4j-api-2.x",
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.9.*": "AwsCrtKotlin-0.9.x",
"aws.sdk.kotlin.crt:aws-crt-kotlin:0.8.*": "AwsCrtKotlin-0.8.x",
"com.squareup.okhttp3:okhttp:4.*": "OkHttp3-4.x"
},
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/api-compat-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: API compatibility verification
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches: [ main, '*-main' ]
branches:
- main
- '*-main'

jobs:
api-compat-verification:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/artifact-size-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Artifact Size Metrics
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches: [ main, '*-main' ]
branches:
- main
- '*-main'
release:
types: [published]

Expand Down Expand Up @@ -55,7 +57,7 @@ jobs:
- name: Generate Artifact Size Metrics
run: ./gradlew -Paws.kotlin.native=false artifactSizeMetrics
- name: Analyze Artifact Size Metrics
run: ./gradlew -Paws.kotlin.native=false analyzeArtifactSizeMetrics
run: ./gradlew analyzeArtifactSizeMetrics
- name: Show Results
uses: actions/github-script@v7
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/changelog-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Changelog verification
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches: [ main, '*-main' ]
branches:
- main
- '*-main'

jobs:
changelog-verification:
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: CI

on:
push:
branches: [ main ]
branches:
- main
- '*-main'
pull_request:
workflow_dispatch:

Expand Down Expand Up @@ -66,7 +68,7 @@ jobs:
run: |
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
./gradlew apiCheck
./gradlew -Paws.sdk.kotlin.crt.disableCrossCompile=true -Paws.kotlin.native.disableCrossCompile=true apiCheck
./gradlew -Paws.sdk.kotlin.crt.disableCrossCompile=true -Paws.kotlin.native.disableCrossCompile=true build

- name: Save Test Reports
Expand Down Expand Up @@ -168,7 +170,7 @@ jobs:

- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.os }}
path: '**/build/reports'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: Dependabot Dependency Submission

on:
push:
branches: [ main ]
branches:
- main
- '*-main'

permissions:
contents: write
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/kat-transform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Kat Transform
on:
pull_request:
types: [ opened, synchronize, reopened, labeled, unlabeled ]
branches: [ main ]
branches:
- main
- '*-main'

# Allow one instance of this workflow per pull request, and cancel older runs when new changes are pushed
concurrency:
Expand All @@ -27,6 +29,9 @@ jobs:
with:
path: 'smithy-kotlin'

- name: Setup build
uses: ./smithy-kotlin/.github/actions/setup-build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand All @@ -36,13 +41,6 @@ jobs:
- name: Setup kat
uses: awslabs/aws-kotlin-repo-tools/.github/actions/setup-kat@main

- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'

- name: Build
working-directory: ./smithy-kotlin
shell: bash
Expand All @@ -51,8 +49,8 @@ jobs:
ls -lsa
kat bump-version # Bump from `vNext-SNAPSHOT` to `vNext`. kat transform only works on non-SNAPSHOT versions
kat bump-version --property codegenVersion
./gradlew build
./gradlew publishAllPublicationsToTestLocalRepository
./gradlew -Paws.kotlin.native=false build
./gradlew -Paws.kotlin.native=false publishAllPublicationsToTestLocalRepository

- name: Transform
working-directory: ./smithy-kotlin
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ on:
branches:
- '**'
- '!main'
- '!*-main'
pull_request:
branches: [ main ]
branches:
- main
- '*-main'
workflow_dispatch:

env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ out/
# Compiled class file
*.class
*.klib
.kotlin/

# Log file
*.log
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## [1.4.1] - 01/16/2025

## [1.4.0] - 01/15/2025

### Features
* [#1431](https://github.com/awslabs/aws-sdk-kotlin/issues/1431) ⚠️ **IMPORTANT**: Add `retryStrategy` configuration option for waiters

### Fixes
* [#1321](https://github.com/awslabs/aws-sdk-kotlin/issues/1321) Include more information when retry strategy halts early due to token bucket capacity errors

### Miscellaneous
* ⚠️ **IMPORTANT**: Upgrade to Kotlin 2.1.0

## [1.3.34] - 01/10/2025

## [1.3.33] - 01/10/2025

## [1.3.32] - 01/06/2025

### Fixes
* Fix serialization of CBOR blobs

## [1.3.31] - 12/18/2024

### Features
Expand Down
13 changes: 10 additions & 3 deletions codegen/protocol-tests/model/error-correction-tests.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ operation SayHello { output: TestOutputDocument, errors: [Error] }
@http(method: "POST", uri: "/")
operation SayHelloXml { output: TestOutput, errors: [Error] }

structure TestOutputDocument with [TestStruct] { innerField: Nested, @required document: Document }
structure TestOutputDocument with [TestStruct] {
innerField: Nested,
// FIXME: This trait fails smithy validator
// @required
document: Document
}
structure TestOutput with [TestStruct] { innerField: Nested }

@mixin
Expand All @@ -60,7 +65,8 @@ structure TestStruct {
@required
nestedListValue: NestedList

@required
// FIXME: This trait fails smithy validator
// @required
nested: Nested

@required
Expand Down Expand Up @@ -91,7 +97,8 @@ union MyUnion {
}

structure Nested {
@required
// FIXME: This trait fails smithy validator
// @required
a: String
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ abstract class AwsHttpBindingProtocolGenerator : HttpBindingProtocolGenerator()
// The following can be used to generate only a specific test by name.
// val targetedTest = TestMemberDelta(setOf("RestJsonComplexErrorWithNoMessage"), TestContainmentMode.RUN_TESTS)

val ignoredTests = TestMemberDelta(setOf())
val ignoredTests = TestMemberDelta(
setOf(
"AwsJson10ClientErrorCorrectsWithDefaultValuesWhenServerFailsToSerializeRequiredValues",
"RestJsonNullAndEmptyHeaders",
"NullAndEmptyHeaders",
"RpcV2CborClientPopulatesDefaultsValuesWhenMissingInResponse",
"RpcV2CborClientPopulatesDefaultValuesInInput",
),
)

val requestTestBuilder = HttpProtocolUnitTestRequestGenerator.Builder()
val responseTestBuilder = HttpProtocolUnitTestResponseGenerator.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ abstract class AbstractQueryFormUrlSerializerGenerator(
return shape.documentSerializer(ctx.settings, symbol, members) { writer ->
writer.openBlock("internal fun #identifier.name:L(serializer: #T, input: #T) {", RuntimeTypes.Serde.Serializer, symbol)
.call {
renderSerializerBody(ctx, shape, shape.members().toList(), writer)
renderSerializerBody(ctx, shape, members.toList(), writer)
}
.closeBlock("}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package software.amazon.smithy.kotlin.codegen.aws.protocols

import io.kotest.matchers.string.shouldNotContain
import software.amazon.smithy.kotlin.codegen.test.*
import kotlin.test.Test

Expand Down Expand Up @@ -145,4 +146,20 @@ class RpcV2CborTest {
val serializeBody = serializer.lines(" override suspend fun serialize(context: ExecutionContext, input: PutFooStreamingRequest): HttpRequestBuilder {", "}")
serializeBody.shouldContainOnlyOnceWithDiff("""builder.headers.setMissing("Content-Type", "application/vnd.amazon.eventstream")""")
}

@Test
fun testEventStreamInitialRequestDoesNotSerializeStreamMember() {
val ctx = model.newTestContext("CborExample")

val generator = RpcV2Cbor()
generator.generateProtocolClient(ctx.generationCtx)

ctx.generationCtx.delegator.finalize()
ctx.generationCtx.delegator.flushWriters()

val documentSerializer = ctx.manifest.expectFileString("/src/main/kotlin/com/test/serde/PutFooStreamingRequestDocumentSerializer.kt")

val serializeBody = documentSerializer.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", "}")
serializeBody.shouldNotContain("input.messages") // `messages` is the stream member and should not be serialized in the initial request
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private fun getDefaultRuntimeVersion(): String {
// publishing info
const val RUNTIME_GROUP: String = "aws.smithy.kotlin"
val RUNTIME_VERSION: String = System.getProperty("smithy.kotlin.codegen.clientRuntimeVersion", getDefaultRuntimeVersion())
val KOTLIN_COMPILER_VERSION: String = System.getProperty("smithy.kotlin.codegen.kotlinCompilerVersion", "2.0.10")
val KOTLIN_COMPILER_VERSION: String = System.getProperty("smithy.kotlin.codegen.kotlinCompilerVersion", "2.1.0")

enum class SourceSet {
CommonMain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ object RuntimeTypes {
object Interceptors : RuntimeTypePackage(KotlinDependency.HTTP, "interceptors") {
val ContinueInterceptor = symbol("ContinueInterceptor")
val HttpInterceptor = symbol("HttpInterceptor")
val Md5ChecksumInterceptor = symbol("Md5ChecksumInterceptor")
val HttpChecksumRequiredInterceptor = symbol("HttpChecksumRequiredInterceptor")
val FlexibleChecksumsRequestInterceptor = symbol("FlexibleChecksumsRequestInterceptor")
val FlexibleChecksumsResponseInterceptor = symbol("FlexibleChecksumsResponseInterceptor")
val ResponseLengthValidationInterceptor = symbol("ResponseLengthValidationInterceptor")
Expand Down Expand Up @@ -231,6 +231,9 @@ object RuntimeTypes {
object Config : RuntimeTypePackage(KotlinDependency.SMITHY_CLIENT, "config") {
val RequestCompressionConfig = symbol("RequestCompressionConfig")
val CompressionClientConfig = symbol("CompressionClientConfig")
val HttpChecksumConfig = symbol("HttpChecksumConfig")
val RequestHttpChecksumConfig = symbol("RequestHttpChecksumConfig")
val ResponseHttpChecksumConfig = symbol("ResponseHttpChecksumConfig")
}

object Endpoints : RuntimeTypePackage(KotlinDependency.SMITHY_CLIENT, "endpoints") {
Expand Down Expand Up @@ -395,6 +398,7 @@ object RuntimeTypes {
val TelemetryContextElement = symbol("TelemetryContextElement", "context")
val TraceSpan = symbol("TraceSpan", "trace")
val withSpan = symbol("withSpan", "trace")
val warn = symbol("warn", "logging")
}
object TelemetryDefaults : RuntimeTypePackage(KotlinDependency.TELEMETRY_DEFAULTS) {
val Global = symbol("Global")
Expand All @@ -409,6 +413,7 @@ object RuntimeTypes {

val CompletableDeferred = "kotlinx.coroutines.CompletableDeferred".toSymbol()
val job = "kotlinx.coroutines.job".toSymbol()
val runBlocking = "kotlinx.coroutines.runBlocking".toSymbol()

object Flow {
// NOTE: smithy-kotlin core has an API dependency on this already
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package software.amazon.smithy.kotlin.codegen.rendering.checksums

import software.amazon.smithy.aws.traits.HttpChecksumTrait
import software.amazon.smithy.kotlin.codegen.KotlinSettings
import software.amazon.smithy.kotlin.codegen.core.KotlinWriter
import software.amazon.smithy.kotlin.codegen.core.RuntimeTypes
import software.amazon.smithy.kotlin.codegen.integration.KotlinIntegration
import software.amazon.smithy.kotlin.codegen.model.hasTrait
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolGenerator
import software.amazon.smithy.kotlin.codegen.rendering.protocol.ProtocolMiddleware
import software.amazon.smithy.model.Model
import software.amazon.smithy.model.shapes.OperationShape
import software.amazon.smithy.model.traits.HttpChecksumRequiredTrait

/**
* Handles the `httpChecksumRequired` trait.
* See: https://smithy.io/2.0/spec/http-bindings.html#httpchecksumrequired-trait
*/
class HttpChecksumRequiredIntegration : KotlinIntegration {
override fun enabledForService(model: Model, settings: KotlinSettings): Boolean =
model.isTraitApplied(HttpChecksumRequiredTrait::class.java)

override fun customizeMiddleware(
ctx: ProtocolGenerator.GenerationContext,
resolved: List<ProtocolMiddleware>,
): List<ProtocolMiddleware> = resolved + httpChecksumRequiredDefaultAlgorithmMiddleware + httpChecksumRequiredMiddleware
}

/**
* Adds default checksum algorithm to the execution context
*/
private val httpChecksumRequiredDefaultAlgorithmMiddleware = object : ProtocolMiddleware {
override val name: String = "httpChecksumRequiredDefaultAlgorithmMiddleware"
override val order: Byte = -2 // Before S3 Express (possibly) changes the default (-1) and before calculating checksum (0)

override fun isEnabledFor(ctx: ProtocolGenerator.GenerationContext, op: OperationShape): Boolean =
op.hasTrait<HttpChecksumRequiredTrait>() && !op.hasTrait<HttpChecksumTrait>()

override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape, writer: KotlinWriter) {
writer.write(
"op.context[#T.DefaultChecksumAlgorithm] = #S",
RuntimeTypes.HttpClient.Operation.HttpOperationContext,
"MD5",
)
}
}

/**
* Adds interceptor to calculate request checksums.
* The `httpChecksum` trait supersedes the `httpChecksumRequired` trait. If both are applied to an operation use `httpChecksum`.
*
* See: https://smithy.io/2.0/aws/aws-core.html#behavior-with-httpchecksumrequired
*/
private val httpChecksumRequiredMiddleware = object : ProtocolMiddleware {
override val name: String = "httpChecksumRequiredMiddleware"

override fun isEnabledFor(ctx: ProtocolGenerator.GenerationContext, op: OperationShape): Boolean =
op.hasTrait<HttpChecksumRequiredTrait>() && !op.hasTrait<HttpChecksumTrait>()

override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape, writer: KotlinWriter) {
writer.write(
"op.interceptors.add(#T())",
RuntimeTypes.HttpClient.Interceptors.HttpChecksumRequiredInterceptor,
)
}
}
Loading
Loading