diff --git a/.changelog/1724096455.md b/.changelog/1724096455.md new file mode 100644 index 0000000000000000000000000000000000000000..5bdead308d799f124ec1166f9806762b8c72827b --- /dev/null +++ b/.changelog/1724096455.md @@ -0,0 +1,13 @@ +--- +applies_to: +- client +- aws-sdk-rust +authors: +- ysaito1001 +references: +- aws-sdk-rust#820 +breaking: false +new_feature: false +bug_fix: true +--- +Re-export `ByteStream`'s `Length` and `FsBuilder`. By making these types available directly within a client crate, customers can use `ByteStream::read_from` without needing to import them separately from the `aws-smithy-types` crate. 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 dac62172a86b7e5d9686346b28c3b43e7f1b0fed..aa1e1d40a1e8f3db6ed6b7604706cedd621af647 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 @@ -82,11 +82,17 @@ fun pubUseSmithyPrimitives( pub use #{ByteStream}; pub use #{AggregatedBytes}; pub use #{Error} as ByteStreamError; + ##[cfg(feature = "rt-tokio")] + pub use #{FsBuilder}; + ##[cfg(feature = "rt-tokio")] + pub use #{Length}; pub use #{SdkBody}; """, "ByteStream" to RuntimeType.smithyTypes(rc).resolve("byte_stream::ByteStream"), "AggregatedBytes" to RuntimeType.smithyTypes(rc).resolve("byte_stream::AggregatedBytes"), "Error" to RuntimeType.smithyTypes(rc).resolve("byte_stream::error::Error"), + "FsBuilder" to RuntimeType.smithyTypes(rc).resolve("byte_stream::FsBuilder"), + "Length" to RuntimeType.smithyTypes(rc).resolve("byte_stream::Length"), "SdkBody" to RuntimeType.smithyTypes(rc).resolve("body::SdkBody"), ) } diff --git a/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt index e320b9745a02ebb9ce4caed25fd7d11aed22dd22..a3ae1ae50b68dd98dbf551701e07b2b7f728a757 100644 --- a/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt +++ b/codegen-core/src/test/kotlin/software/amazon/smithy/rust/codegen/core/smithy/customizations/SmithyTypesPubUseExtraTest.kt @@ -147,7 +147,12 @@ class SmithyTypesPubUseExtraTest { @Test fun `it re-exports ByteStream and AggregatedBytes when a model has streaming`() { val streamingTypes = - listOf("::aws_smithy_types::byte_stream::ByteStream", "::aws_smithy_types::byte_stream::AggregatedBytes") + listOf( + "::aws_smithy_types::byte_stream::ByteStream", + "::aws_smithy_types::byte_stream::AggregatedBytes", + "::aws_smithy_types::byte_stream::FsBuilder", + "::aws_smithy_types::byte_stream::Length", + ) val streamingShape = "@streaming blob Streaming" this.assertDoesntHaveReexports(reexportsWithEmptyModel(), streamingTypes)