From e6a6b3243ed9a51f608a108d4df12f0a3ef62667 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Fri, 13 Oct 2023 16:01:09 -0500 Subject: [PATCH 1/6] Re-point those using `BuildError` from smithy-http to smithy-types --- aws/rust-runtime/aws-inlineable/Cargo.toml | 4 ++-- .../aws-inlineable/src/http_request_checksum.rs | 2 +- .../integration-tests/s3/tests/required-query-params.rs | 2 +- .../codegen/core/smithy/generators/BuilderGenerator.kt | 4 ++-- .../src/protocol/aws_json/rejection.rs | 2 +- .../src/protocol/rest_json_1/rejection.rs | 4 ++-- .../src/protocol/rest_xml/rejection.rs | 4 ++-- rust-runtime/aws-smithy-http/src/operation.rs | 7 ------- 8 files changed, 11 insertions(+), 18 deletions(-) diff --git a/aws/rust-runtime/aws-inlineable/Cargo.toml b/aws/rust-runtime/aws-inlineable/Cargo.toml index 56ccc8068e..2e902d2776 100644 --- a/aws/rust-runtime/aws-inlineable/Cargo.toml +++ b/aws/rust-runtime/aws-inlineable/Cargo.toml @@ -16,12 +16,12 @@ aws-credential-types = { path = "../aws-credential-types" } aws-http = { path = "../aws-http" } aws-runtime = { path = "../aws-runtime" } aws-sigv4 = { path = "../aws-sigv4" } +aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] } aws-smithy-checksums = { path = "../../../rust-runtime/aws-smithy-checksums" } aws-smithy-http = { path = "../../../rust-runtime/aws-smithy-http" } -aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] } aws-smithy-runtime = { path = "../../../rust-runtime/aws-smithy-runtime", features = ["client"] } +aws-smithy-runtime-api = { path = "../../../rust-runtime/aws-smithy-runtime-api", features = ["client"] } aws-smithy-types = { path = "../../../rust-runtime/aws-smithy-types" } -aws-smithy-async = { path = "../../../rust-runtime/aws-smithy-async", features = ["rt-tokio"] } bytes = "1" hex = "0.4.3" http = "0.2.9" diff --git a/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs b/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs index c6ce150e5b..9555744d7d 100644 --- a/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs +++ b/aws/rust-runtime/aws-inlineable/src/http_request_checksum.rs @@ -13,7 +13,6 @@ use aws_sigv4::http_request::SignableBody; use aws_smithy_checksums::ChecksumAlgorithm; use aws_smithy_checksums::{body::calculate, http::HttpChecksum}; use aws_smithy_http::body::{BoxBody, SdkBody}; -use aws_smithy_http::operation::error::BuildError; use aws_smithy_runtime_api::box_error::BoxError; use aws_smithy_runtime_api::client::interceptors::context::{ BeforeSerializationInterceptorContextRef, BeforeTransmitInterceptorContextMut, Input, @@ -21,6 +20,7 @@ use aws_smithy_runtime_api::client::interceptors::context::{ use aws_smithy_runtime_api::client::interceptors::Interceptor; use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; use aws_smithy_types::config_bag::{ConfigBag, Layer, Storable, StoreReplace}; +use aws_smithy_types::error::operation::BuildError; use http::HeaderValue; use http_body::Body; use std::{fmt, mem}; diff --git a/aws/sdk/integration-tests/s3/tests/required-query-params.rs b/aws/sdk/integration-tests/s3/tests/required-query-params.rs index 1df7f44e4e..d9604260ea 100644 --- a/aws/sdk/integration-tests/s3/tests/required-query-params.rs +++ b/aws/sdk/integration-tests/s3/tests/required-query-params.rs @@ -6,8 +6,8 @@ use aws_sdk_s3::config::{Credentials, Region}; use aws_sdk_s3::error::DisplayErrorContext; use aws_sdk_s3::Client; -use aws_smithy_http::operation::error::BuildError; use aws_smithy_runtime::client::http::test_util::capture_request; +use aws_smithy_types::error::operation::BuildError; #[tokio::test] async fn test_error_when_required_query_param_is_unset() { diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt index 80b9329d63..9369423757 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/generators/BuilderGenerator.kt @@ -75,8 +75,8 @@ sealed class BuilderSection(name: String) : Section(name) { /** Customizations for BuilderGenerator */ abstract class BuilderCustomization : NamedCustomization() -fun RuntimeConfig.operationBuildError() = RuntimeType.operationModule(this).resolve("error::BuildError") -fun RuntimeConfig.serializationError() = RuntimeType.operationModule(this).resolve("error::SerializationError") +fun RuntimeConfig.operationBuildError() = RuntimeType.smithyTypes(this).resolve("error::operation::BuildError") +fun RuntimeConfig.serializationError() = RuntimeType.smithyTypes(this).resolve("error::operation::SerializationError") fun MemberShape.enforceRequired( field: Writable, diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs b/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs index 491e865dd6..514b06da63 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/aws_json/rejection.rs @@ -9,7 +9,7 @@ use thiserror::Error; #[derive(Debug, Error)] pub enum ResponseRejection { #[error("error serializing JSON-encoded body: {0}")] - Serialization(#[from] aws_smithy_http::operation::error::SerializationError), + Serialization(#[from] aws_smithy_types::error::operation::SerializationError), #[error("error building HTTP response: {0}")] HttpBuild(#[from] http::Error), } diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs b/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs index 8577d4a557..963b56c4c1 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/rest_json_1/rejection.rs @@ -67,7 +67,7 @@ pub enum ResponseRejection { /// `httpHeader` or `httpPrefixHeaders`. /// Used when failing to serialize an `httpPayload`-bound struct into an HTTP response body. #[error("error building HTTP response: {0}")] - Build(#[from] aws_smithy_http::operation::error::BuildError), + Build(#[from] aws_smithy_types::error::operation::BuildError), /// Used when failing to serialize a struct into a `String` for the JSON-encoded HTTP response /// body. @@ -76,7 +76,7 @@ pub enum ResponseRejection { /// supplied timestamp is outside of the valid range when formatting using RFC-3339, i.e. a /// date outside the `0001-01-01T00:00:00.000Z`-`9999-12-31T23:59:59.999Z` range is supplied. #[error("error serializing JSON-encoded body: {0}")] - Serialization(#[from] aws_smithy_http::operation::error::SerializationError), + Serialization(#[from] aws_smithy_types::error::operation::SerializationError), /// Used when consuming an [`http::response::Builder`] into the constructed [`http::Response`] /// when calling [`http::response::Builder::body`]. diff --git a/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs b/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs index 3e1bed00ca..6c44adaa28 100644 --- a/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs +++ b/rust-runtime/aws-smithy-http-server/src/protocol/rest_xml/rejection.rs @@ -16,9 +16,9 @@ pub enum ResponseRejection { #[error("invalid bound HTTP status code; status codes must be inside the 100-999 range: {0}")] InvalidHttpStatusCode(TryFromIntError), #[error("error building HTTP response: {0}")] - Build(#[from] aws_smithy_http::operation::error::BuildError), + Build(#[from] aws_smithy_types::error::operation::BuildError), #[error("error serializing XML-encoded body: {0}")] - Serialization(#[from] aws_smithy_http::operation::error::SerializationError), + Serialization(#[from] aws_smithy_types::error::operation::SerializationError), #[error("error building HTTP response: {0}")] HttpBuild(#[from] http::Error), } diff --git a/rust-runtime/aws-smithy-http/src/operation.rs b/rust-runtime/aws-smithy-http/src/operation.rs index 0fed557b79..cba5082871 100644 --- a/rust-runtime/aws-smithy-http/src/operation.rs +++ b/rust-runtime/aws-smithy-http/src/operation.rs @@ -9,13 +9,6 @@ use aws_smithy_types::config_bag::{Storable, StoreReplace}; use std::borrow::Cow; -//TODO(runtimeCratesVersioningCleanup): Re-point those who use the following reexport to -// directly depend on `aws_smithy_types` and remove the reexport below. -/// Errors for operations -pub mod error { - pub use aws_smithy_types::error::operation::{BuildError, SerializationError}; -} - /// Metadata added to the [`ConfigBag`](aws_smithy_types::config_bag::ConfigBag) that identifies the API being called. #[derive(Clone, Debug)] pub struct Metadata { From 29dfe4d335c8190f06f3d4bfca6f91ba7e972900 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Fri, 13 Oct 2023 16:54:28 -0500 Subject: [PATCH 2/6] Update CHANGELOG.next.toml --- CHANGELOG.next.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 8d6525eb8e..7ab0a1d756 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -355,3 +355,11 @@ message = "Lifetimes have been added to the `EndpointResolver` trait." references = ["smithy-rs#3061"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } author = "jdisanti" + +[[smithy-rs]] +message = """ +`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`. +""" +references = ["smithy-rs#3054", "smithy-rs#3070"] +meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } +author = "ysaito1001" From c95849c3a1af71ef243f0b59a3901bf9159a050f Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Mon, 16 Oct 2023 13:35:10 -0500 Subject: [PATCH 3/6] Put re-export back to `smithy-http` to avoid cutover This commit addresses https://github.com/awslabs/smithy-rs/pull/3070#discussion_r1360892198 --- rust-runtime/aws-smithy-http/src/operation.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rust-runtime/aws-smithy-http/src/operation.rs b/rust-runtime/aws-smithy-http/src/operation.rs index cba5082871..0fed557b79 100644 --- a/rust-runtime/aws-smithy-http/src/operation.rs +++ b/rust-runtime/aws-smithy-http/src/operation.rs @@ -9,6 +9,13 @@ use aws_smithy_types::config_bag::{Storable, StoreReplace}; use std::borrow::Cow; +//TODO(runtimeCratesVersioningCleanup): Re-point those who use the following reexport to +// directly depend on `aws_smithy_types` and remove the reexport below. +/// Errors for operations +pub mod error { + pub use aws_smithy_types::error::operation::{BuildError, SerializationError}; +} + /// Metadata added to the [`ConfigBag`](aws_smithy_types::config_bag::ConfigBag) that identifies the API being called. #[derive(Clone, Debug)] pub struct Metadata { From 6df9f1073b7980a56ea60ddcdcfeebed762f9637 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Mon, 16 Oct 2023 22:35:57 -0500 Subject: [PATCH 4/6] Add deprecated type aliases to moved types This commit addresses https://github.com/awslabs/smithy-rs/pull/3070#discussion_r1360892433 --- rust-runtime/aws-smithy-http/src/operation.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rust-runtime/aws-smithy-http/src/operation.rs b/rust-runtime/aws-smithy-http/src/operation.rs index 0fed557b79..7fad89f1e1 100644 --- a/rust-runtime/aws-smithy-http/src/operation.rs +++ b/rust-runtime/aws-smithy-http/src/operation.rs @@ -9,11 +9,17 @@ use aws_smithy_types::config_bag::{Storable, StoreReplace}; use std::borrow::Cow; -//TODO(runtimeCratesVersioningCleanup): Re-point those who use the following reexport to -// directly depend on `aws_smithy_types` and remove the reexport below. +//TODO(runtimeCratesVersioningCleanup): Re-point those who use the deprecated type aliases to +// directly depend on `aws_smithy_types` and remove the type aliases below. /// Errors for operations pub mod error { - pub use aws_smithy_types::error::operation::{BuildError, SerializationError}; + /// An error occurred attempting to build an `Operation` from an input. + #[deprecated(note = "Moved to `aws_smithy_types::error::operation::BuildError`.")] + pub type BuildError = aws_smithy_types::error::operation::BuildError; + + /// An error that occurs when serialization of an operation fails. + #[deprecated(note = "Moved to `aws_smithy_types::error::operation::SerializationError`.")] + pub type SerializationError = aws_smithy_types::error::operation::SerializationError; } /// Metadata added to the [`ConfigBag`](aws_smithy_types::config_bag::ConfigBag) that identifies the API being called. From 45c813d2d81563005173fa1e4ee0c0e0a2d43151 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Tue, 17 Oct 2023 14:55:55 -0500 Subject: [PATCH 5/6] Update CHANGELOG.next.toml --- CHANGELOG.next.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 7fd23d13d9..81f8fe3ffb 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -411,7 +411,7 @@ author = "jdisanti" [[smithy-rs]] message = """ -`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`. +`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`. Type aliases for them are left in `aws_smithy_http` for backwards compatibility but being deprecated. """ references = ["smithy-rs#3054", "smithy-rs#3070"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" } From f6ccf7ea60a6ed68744d1c810f62f89db9a98aae Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Thu, 19 Oct 2023 10:25:22 -0500 Subject: [PATCH 6/6] Update CHANGELOG.next.toml Co-authored-by: Russell Cohen --- CHANGELOG.next.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 81f8fe3ffb..3f118f6132 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -411,7 +411,7 @@ author = "jdisanti" [[smithy-rs]] message = """ -`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`. Type aliases for them are left in `aws_smithy_http` for backwards compatibility but being deprecated. +`aws_smithy_http::operation::error::{BuildError, SerializationError}` have been moved to `aws_smithy_types::error::operation::{BuildError, SerializationError}`. Type aliases for them are left in `aws_smithy_http` for backwards compatibility but are deprecated. """ references = ["smithy-rs#3054", "smithy-rs#3070"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "all" }