Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .changelog/1763408225.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
applies_to: ["server"]
authors: ["rcoh"]
references: ["smithy-rs#4400", "smithy-rs#4397"]
breaking: true
new_feature: false
bug_fix: true
---
Fix issue where SigV4 envelopes for EventStreams did not support the initial message. This is _technically_ a breaking change but should not break consumers in practice since the
resulting type has the same methods.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ sealed class HttpBindingSection(name: String) : Section(name) {

data class AfterDeserializingIntoADateTimeOfHttpHeaders(val memberShape: MemberShape) :
HttpBindingSection("AfterDeserializingIntoADateTimeOfHttpHeaders")

data class BeforeCreatingEventStreamReceiver(
val operationShape: OperationShape,
val unionShape: UnionShape,
val unmarshallerVariableName: String,
) : HttpBindingSection("BeforeCreatingEventStreamReceiver")
}

typealias HttpBindingCustomization = NamedCustomization<HttpBindingSection>
Expand Down Expand Up @@ -282,21 +276,11 @@ class HttpBindingGenerator(
"unmarshallerConstructorFn" to unmarshallerConstructorFn,
)

// Allow customizations to wrap the unmarshaller
for (customization in customizations) {
customization.section(
HttpBindingSection.BeforeCreatingEventStreamReceiver(
operationShape,
targetShape,
"unmarshaller",
),
)(this)
}

rustTemplate(
"""
let body = std::mem::replace(body, #{SdkBody}::taken());
Ok(#{receiver:W})
let receiver = #{receiver:W};
Ok(receiver)
""",
"SdkBody" to RuntimeType.sdkBody(runtimeConfig),
"receiver" to
Expand Down
2 changes: 1 addition & 1 deletion codegen-server-test/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ val commonCodegenTests = "../codegen-core/common-test-models".let { commonModels
)
}
// When iterating on protocol tests use this to speed up codegen:
// .filter { it.module == "rpcv2Cbor_extras" || it.module == "rpcv2Cbor_extras_no_initial_response" }
// .filter { it.module == "rpcv2Cbor_extras" || it.module == "rpcv2Cbor_extras_no_initial_response" }

val customCodegenTests = "custom-test-models".let { customModels ->
listOf(
Expand Down
154 changes: 152 additions & 2 deletions codegen-server-test/integration-tests/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ aws-smithy-runtime = { workspace = true }
http-body-util = "0.1.3"
hyper-util = { version = "0.1.17", features = ["client-legacy", "tokio", "http2", "http1"] }
tokio-stream = "0.1.17"
tracing = "0.1.41"
rstest = "0.23"
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ManualEventStreamClient {
tokio::spawn(async move {
while let Some(message) = message_receiver.recv().await {
let mut buffer = Vec::new();
if let Err(_) = write_message_to(&message, &mut buffer) {
if write_message_to(&message, &mut buffer).is_err() {
break;
}
let _ = frame_sender
Expand Down Expand Up @@ -131,7 +131,7 @@ impl ManualEventStreamClient {
self.message_sender
.send(message)
.await
.map_err(|e| format!("Send failed: {}", e))
.map_err(|e| format!("Send failed: {e}"))
}

/// Receives the next response message.
Expand Down
Loading
Loading