Skip to content

Commit 1122d32

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 61b52da + 6164276 commit 1122d32

File tree

71 files changed

+260
-172
lines changed

Some content is hidden

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

71 files changed

+260
-172
lines changed

.changelog/1759416345.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

AGENTS.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Smithy-rs AI Agent Guide
2+
3+
## Package Layout
4+
5+
- **`codegen-core/`** - Shared codegen
6+
- **`codegen-server/`** - Server codegen
7+
- **`codegen-client/`** - Client codegen
8+
- **`rust-runtime/`** - Runtime libraries
9+
- **`codegen-server-test/`** - Server integration tests
10+
11+
Protocol files: `codegen-{core,server}/.../protocols/`
12+
13+
## preludeScope: Rust Prelude Types
14+
15+
**Always use `preludeScope` for Rust prelude types:**
16+
17+
```kotlin
18+
rustTemplate(
19+
"let result: #{Result}<#{String}, #{Error}> = #{Ok}(value);",
20+
*preludeScope, // Provides Result, String, Ok
21+
"Error" to myErrorType
22+
)
23+
```
24+
25+
❌ Wrong: `"let result: Result<String, Error> = Ok(value);"`
26+
✅ Correct: Use `*preludeScope` in templates
27+
28+
## RuntimeType and Dependencies
29+
30+
`RuntimeType` objects contain:
31+
- **`path`**: Rust path (e.g., `"::mime::Mime"`)
32+
- **`dependency`**: `CargoDependency` or `InlineDependency`
33+
34+
Using a `RuntimeType` automatically adds its dependency to `Cargo.toml`.
35+
36+
### Creating RuntimeTypes
37+
38+
```kotlin
39+
// Pre-defined dependencies
40+
val Mime = CargoDependency.Mime.toType()
41+
val Bytes = CargoDependency.Bytes.toType().resolve("Bytes")
42+
43+
// Runtime crates
44+
val smithyTypes = RuntimeType.smithyTypes(runtimeConfig)
45+
```
46+
47+
### Always Use Symbols
48+
49+
❌ Wrong: `rust("const MIME: ::mime::Mime = ::mime::APPLICATION_JSON;")`
50+
✅ Correct: `rustTemplate("const MIME: #{Mime}::Mime = #{Mime}::APPLICATION_JSON;", "Mime" to RuntimeType.Mime)`
51+
52+
## RuntimeType.forInlineFun: Lazy Generation
53+
54+
Code is only generated if used. `forInlineFun` enables lazy generation:
55+
56+
```kotlin
57+
val mimeType = RuntimeType.forInlineFun("APPLICATION_JSON", module) {
58+
rustTemplate(
59+
"pub const APPLICATION_JSON: #{Mime}::Mime = #{Mime}::APPLICATION_JSON;",
60+
"Mime" to RuntimeType.Mime
61+
)
62+
}
63+
```
64+
65+
⚠️ **Footgun**: Name collisions mean only one implementation gets generated.
66+
67+
## Testing
68+
69+
### Integration Tests
70+
Test actual generated code, not just codegen logic:
71+
72+
```kotlin
73+
serverIntegrationTest(model) { codegenContext, rustCrate ->
74+
rustCrate.testModule {
75+
tokioTest("test_accept_header") {
76+
rustTemplate("""
77+
let request = ::http::Request::builder()
78+
.header("Accept", "application/cbor")
79+
.body(Body::empty()).unwrap();
80+
let result = MyInput::from_request(request).await;
81+
result.expect("should accept valid header");
82+
""")
83+
}
84+
}
85+
}
86+
```
87+
88+
### Running Tests
89+
90+
**Codegen tests:**
91+
```bash
92+
./gradlew test --tests "*MyTest*"
93+
./gradlew codegen-server-test:assemble --quiet
94+
```
95+
96+
**Debug failing tests:**
97+
```bash
98+
# Remove --quiet to see failure details
99+
./gradlew :codegen-core:test --tests "*InlineDependencyTest*"
100+
# Extract just the error from HTML report (avoid HTML markup pollution)
101+
grep -A 5 "AssertionError\|Exception" codegen-core/build/reports/tests/test/classes/software.amazon.smithy.rust.codegen.core.rustlang.InlineDependencyTest.html
102+
```
103+
104+
**Runtime tests:**
105+
```bash
106+
cd rust-runtime && cargo test --quiet -p aws-smithy-types
107+
```
108+
109+
**Protocol tests:**
110+
```bash
111+
./gradlew codegen-client-test:assemble --quiet
112+
cd codegen-client-test/build/smithyprojections/codegen-client-test/rest_xml_extras/rust-client-codegen
113+
cargo test --quiet
114+
```
115+
116+
## Viewing Generated Code
117+
118+
Generated code appears in:
119+
```
120+
codegen-server-test/build/smithyprojections/codegen-server-test/SERVICE_NAME/rust-server-codegen/
121+
```
122+
123+
Enable debug comments:
124+
```kotlin
125+
serverIntegrationTest(model, IntegrationTestParams(
126+
additionalSettings = ServerAdditionalSettings.builder()
127+
.generateCodegenComments() // Adds Kotlin source line comments
128+
.toObjectNode()
129+
)) { /* test code */ }
130+
```

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
<!-- Do not manually edit this file. Use the `changelogger` tool. -->
2+
October 6th, 2025
3+
=================
4+
**New this release:**
5+
- :tada: (server, [smithy-rs#4321](https://github.com/smithy-lang/smithy-rs/issues/4321), @jasgin) Adds the custom traits `@validationException`, `@validationMessage`, `@validationFieldList`, `@validationFieldName`, and `@validationFieldMessage`
6+
for defining custom validation exceptions.
7+
8+
**Contributors**
9+
Thank you for your contributions! ❤
10+
- @jasgin ([smithy-rs#4321](https://github.com/smithy-lang/smithy-rs/issues/4321))
11+
12+
213
October 2nd, 2025
314
=================
415
**New this release:**

aws/SDK_CHANGELOG.next.json

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,6 @@
55
{
66
"smithy-rs": [],
77
"aws-sdk-rust": [
8-
{
9-
"message": "Add support for proxy environment variables (`HTTP_PROXY, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY`). Service clients will now automatically respect these proxy environment variables on the latest `BehaviorVersion`. Older behavior versions do not automatically detect these environment variables and will require manually building a `aws_smithy_http_client::Connector` with a proxy config explicitly set to use this feature.\n",
10-
"meta": {
11-
"bug": false,
12-
"breaking": false,
13-
"tada": true
14-
},
15-
"author": "aajtodd",
16-
"references": [
17-
"aws-sdk-rust#169"
18-
],
19-
"since-commit": "520d073c2d739e95d112842be13c924097155d47",
20-
"age": 5
21-
},
22-
{
23-
"message": "Enable rustls post-quantum by default.\n",
24-
"meta": {
25-
"bug": false,
26-
"breaking": false,
27-
"tada": true
28-
},
29-
"author": "WillChilds-Klein",
30-
"references": [],
31-
"since-commit": "520d073c2d739e95d112842be13c924097155d47",
32-
"age": 5
33-
},
34-
{
35-
"message": "fix `aws-smithy-eventstream` feature `derive-arbitrary` on `arbitrary` >= 1.4.2\n",
36-
"meta": {
37-
"bug": false,
38-
"breaking": false,
39-
"tada": false
40-
},
41-
"author": "aajtodd",
42-
"references": [],
43-
"since-commit": "520d073c2d739e95d112842be13c924097155d47",
44-
"age": 5
45-
},
468
{
479
"message": "Make [`TokenBucket`](https://docs.rs/aws-smithy-runtime/latest/aws_smithy_runtime/client/retries/struct.TokenBucket.html) and [`ClientRateLimiter`](https://docs.rs/aws-smithy-runtime/latest/aws_smithy_runtime/client/retries/struct.ClientRateLimiter.html) configurable through [`RetryPartition`](https://docs.rs/aws-smithy-runtime/latest/aws_smithy_runtime/client/retries/struct.RetryPartition.html).\n",
4810
"meta": {
@@ -55,7 +17,7 @@
5517
"smithy-rs#4263"
5618
],
5719
"since-commit": "f18c70d36c40fa0f40860547394c134566704e69",
58-
"age": 4
20+
"age": 5
5921
}
6022
],
6123
"aws-sdk-model": []

aws/rust-runtime/aws-config/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
/* Automatically managed default lints */
7-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
7+
#![cfg_attr(docsrs, feature(doc_cfg))]
88
/* End of automatically managed default lints */
99
#![allow(clippy::derive_partial_eq_without_eq)]
1010
#![warn(

aws/rust-runtime/aws-credential-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-credential-types"
3-
version = "1.2.7"
3+
version = "1.2.8"
44
authors = ["AWS Rust SDK Team <[email protected]>"]
55
description = "Types for AWS SDK credentials."
66
edition = "2021"

aws/rust-runtime/aws-credential-types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
/* Automatically managed default lints */
7-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
7+
#![cfg_attr(docsrs, feature(doc_cfg))]
88
/* End of automatically managed default lints */
99
//! `aws-credential-types` provides types concerned with AWS SDK credentials including:
1010
//! * Traits for credentials providers and for credentials caching

aws/rust-runtime/aws-inlineable/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
/* Automatically managed default lints */
7-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
7+
#![cfg_attr(docsrs, feature(doc_cfg))]
88
/* End of automatically managed default lints */
99
//! Collection of modules that get conditionally included directly into the code generated
1010
//! SDK service crates. For example, when generating S3, the `s3_errors` module will get copied

aws/rust-runtime/aws-runtime-api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-runtime-api"
3-
version = "1.1.8"
3+
version = "1.1.9"
44
authors = ["AWS Rust SDK Team <[email protected]>"]
55
description = "Runtime support code for the AWS SDK. This isn't intended to be used directly."
66
edition = "2021"

aws/rust-runtime/aws-runtime-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
/* Automatically managed default lints */
7-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
7+
#![cfg_attr(docsrs, feature(doc_cfg))]
88
/* End of automatically managed default lints */
99
//! Runtime support code for the AWS SDK. This crate isn't intended to be used directly.
1010

0 commit comments

Comments
 (0)