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
12 changes: 12 additions & 0 deletions .changelog/1762045039.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
applies_to:
- server
authors:
- drganjoo
references:
- smithy-rs#9999
breaking: false
new_feature: false
bug_fix: true
---
Fix missing BuildError support in aws_json ResponseRejection. This fixes compilation errors when using AwsJson protocols with streaming operations.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package software.amazon.smithy.rust.codegen.server.smithy

import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.EnumSource
import software.amazon.smithy.rust.codegen.core.testutil.IntegrationTestParams
import software.amazon.smithy.rust.codegen.core.testutil.ServerAdditionalSettings
import software.amazon.smithy.rust.codegen.server.smithy.testutil.serverIntegrationTest

/**
* Test to verify AwsJson protocols compile correctly with streaming operations.
*
* This test ensures that the ResponseRejection enum in aws_json protocol
* has proper From implementations for BuildError, which is needed when
* serializing HTTP payloads for streaming operations.
*/
internal class AwsJsonCompilationTest {
@ParameterizedTest
@EnumSource(
value = ModelProtocol::class,
names = ["AwsJson10", "AwsJson11"],
)
fun `AwsJson protocols should compile with streaming operations`(protocol: ModelProtocol) {
val (model) = loadSmithyConstraintsModelForProtocol(protocol)
serverIntegrationTest(
model,
IntegrationTestParams(
additionalSettings =
ServerAdditionalSettings.builder()
.publicConstrainedTypes(true)
.generateCodegenComments(true)
.toObjectNode(),
),
) { _, _ ->
// Test passes if code generation and compilation succeed
}
}
}
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-http-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aws-smithy-http-server"
version = "0.65.8"
version = "0.65.9"
authors = ["Smithy Rust Server <[email protected]>"]
edition = "2021"
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use thiserror::Error;

#[derive(Debug, Error)]
pub enum ResponseRejection {
#[error("error building HTTP response: {0}")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually a breaking change because this enum is not marked non_exhaustive. I don't know how much breakage will exist in practice.

Build(#[from] aws_smithy_types::error::operation::BuildError),
#[error("error serializing JSON-encoded body: {0}")]
Serialization(#[from] aws_smithy_types::error::operation::SerializationError),
#[error("error building HTTP response: {0}")]
Expand Down
Loading