From fcb12fb562813ea9088e9fc6904727d2f6386279 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Thu, 13 Apr 2023 17:58:43 -0500 Subject: [PATCH] Re-export `aws_smithy_types::date_time::Format` in service client crates (#2534) * Add more client crate re-exports This commit adds two more client re-exports that were not included in smithy-rs#2437: - `aws_smithy_http::byte_stream::Length` - `aws_smithy_types::date_time::Format` * Remove re-export of `aws_smithy_http::byte_stream::Length` This commit removes re-export of `aws_smithy_http::byte_stream::Length` for now as it is a feature-gated type, which requires further consideration. * CHANGELOG.next.toml --------- Co-authored-by: Yuki Saito --- CHANGELOG.next.toml | 12 ++++++++++++ .../smithy/rust/codegen/core/smithy/RuntimeType.kt | 1 + .../smithy/customizations/SmithyTypesPubUseExtra.kt | 1 + 3 files changed, 14 insertions(+) diff --git a/CHANGELOG.next.toml b/CHANGELOG.next.toml index 1832de5613..e07d004d2a 100644 --- a/CHANGELOG.next.toml +++ b/CHANGELOG.next.toml @@ -92,3 +92,15 @@ message = "Update the `std::fmt::Debug` implementation for `aws-sigv4::SigningPa references = ["smithy-rs#2562"] meta = { "breaking" = false, "tada" = true, "bug" = true } author = "Velfi" + +[[aws-sdk-rust]] +message = "`aws_smithy_types::date_time::Format` has been re-exported in service client crates." +references = ["smithy-rs#2534"] +meta = { "breaking" = false, "tada" = false, "bug" = false } +author = "ysaito1001" + +[[smithy-rs]] +message = "`aws_smithy_types::date_time::Format` has been re-exported in service client crates." +references = ["smithy-rs#2534"] +meta = { "breaking" = false, "tada" = false, "bug" = false, "target" = "client" } +author = "ysaito1001" diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt index b74fbf2b9a..7e53055195 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/RuntimeType.kt @@ -278,6 +278,7 @@ data class RuntimeType(val path: String, val dependency: RustDependency? = null) fun classifyRetry(runtimeConfig: RuntimeConfig) = smithyHttp(runtimeConfig).resolve("retry::ClassifyRetry") fun dateTime(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("DateTime") fun document(runtimeConfig: RuntimeConfig): RuntimeType = smithyTypes(runtimeConfig).resolve("Document") + fun format(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("date_time::Format") fun retryErrorKind(runtimeConfig: RuntimeConfig) = smithyTypes(runtimeConfig).resolve("retry::ErrorKind") fun eventStreamReceiver(runtimeConfig: RuntimeConfig): RuntimeType = smithyHttp(runtimeConfig).resolve("event_stream::Receiver") fun eventStreamSender(runtimeConfig: RuntimeConfig): RuntimeType = smithyHttp(runtimeConfig).resolve("event_stream::EventStreamSender") diff --git a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt index ec49a97613..301ee11da8 100644 --- a/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt +++ b/codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtra.kt @@ -58,6 +58,7 @@ private fun pubUseTypesThatShouldBeExported(codegenContext: CodegenContext, mode listOf( PubUseType(RuntimeType.blob(runtimeConfig), ::hasBlobs), PubUseType(RuntimeType.dateTime(runtimeConfig), ::hasDateTimes), + PubUseType(RuntimeType.format(runtimeConfig), ::hasDateTimes, "DateTimeFormat"), ) + RuntimeType.smithyHttp(runtimeConfig).let { http -> listOf( PubUseType(http.resolve("byte_stream::ByteStream"), ::hasStreamingOperations),