Loading CHANGELOG.next.toml +5 −0 Original line number Diff line number Diff line Loading @@ -282,3 +282,8 @@ references = ["smithy-rs#2433"] meta = { "breaking" = true, "tada" = false, "bug" = false } author = "jdisanti" [[smithy-rs]] message = "The modules in generated client crates have been reorganized. See the [Client Crate Reorganization Upgrade Guidance](https://github.com/awslabs/smithy-rs/discussions/2449) to see how to fix your code after this change." references = ["smithy-rs#2448"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } author = "jdisanti" buildSrc/src/main/kotlin/CodegenTestCommon.kt +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ private fun generateSmithyBuild(projectDir: String, pluginName: String, tests: L "relativePath": "$projectDir/rust-runtime" }, "codegen": { "enableNewCrateOrganizationScheme": false "enableNewCrateOrganizationScheme": true }, "service": "${it.service}", "module": "${it.module}", Loading codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustModule.kt +3 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import software.amazon.smithy.model.traits.ErrorTrait import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientDocs import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency import software.amazon.smithy.rust.codegen.core.rustlang.EscapeFor import software.amazon.smithy.rust.codegen.core.rustlang.RustModule import software.amazon.smithy.rust.codegen.core.rustlang.RustReservedWords import software.amazon.smithy.rust.codegen.core.rustlang.Visibility Loading Loading @@ -149,7 +150,7 @@ class ClientModuleDocProvider( by calling the `customize()` method on the builder returned from a client operation call. For example, this can be used to add an additional HTTP header: ```no_run ```ignore ## async fn wrapper() -> Result<(), $moduleUseName::Error> { ## let client: $moduleUseName::Client = unimplemented!(); use #{http}::header::{HeaderName, HeaderValue}; Loading Loading @@ -217,7 +218,7 @@ object ClientModuleProvider : ModuleProvider { val operationShape = shape.findOperation(context.model) val contextName = operationShape.contextName(context.serviceShape) val operationModuleName = RustReservedWords.escapeIfNeeded(contextName.toSnakeCase()) RustReservedWords.escapeIfNeeded(contextName.toSnakeCase(), EscapeFor.ModuleName) return RustModule.public( operationModuleName, parent = ClientRustModule.Operation, Loading codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustSettings.kt +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ data class ClientCodegenConfig( private const val defaultIncludeFluentClient = true private const val defaultAddMessageToErrors = true private val defaultEventStreamAllowList: Set<String> = emptySet() private const val defaultEnableNewCrateOrganizationScheme = false private const val defaultEnableNewCrateOrganizationScheme = true fun fromCodegenConfigAndNode(coreCodegenConfig: CoreCodegenConfig, node: Optional<ObjectNode>) = if (node.isPresent) { Loading @@ -109,7 +109,7 @@ data class ClientCodegenConfig( renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", defaultRenameExceptions), includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", defaultIncludeFluentClient), addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", defaultAddMessageToErrors), enableNewCrateOrganizationScheme = node.get().getBooleanMemberOrDefault("enableNewCrateOrganizationScheme", false), enableNewCrateOrganizationScheme = node.get().getBooleanMemberOrDefault("enableNewCrateOrganizationScheme", defaultEnableNewCrateOrganizationScheme), ) } else { ClientCodegenConfig( Loading codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ErrorGenerator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class ErrorGenerator( override fun section(section: BuilderSection): Writable = writable { when (section) { is BuilderSection.AdditionalFields -> { rust("meta: Option<#T>,", errorMetadata(runtimeConfig)) rust("meta: std::option::Option<#T>,", errorMetadata(runtimeConfig)) } is BuilderSection.AdditionalMethods -> { Loading @@ -102,7 +102,7 @@ class ErrorGenerator( } /// Sets error metadata pub fn set_meta(&mut self, meta: Option<#{error_metadata}>) -> &mut Self { pub fn set_meta(&mut self, meta: std::option::Option<#{error_metadata}>) -> &mut Self { self.meta = meta; self } Loading Loading
CHANGELOG.next.toml +5 −0 Original line number Diff line number Diff line Loading @@ -282,3 +282,8 @@ references = ["smithy-rs#2433"] meta = { "breaking" = true, "tada" = false, "bug" = false } author = "jdisanti" [[smithy-rs]] message = "The modules in generated client crates have been reorganized. See the [Client Crate Reorganization Upgrade Guidance](https://github.com/awslabs/smithy-rs/discussions/2449) to see how to fix your code after this change." references = ["smithy-rs#2448"] meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" } author = "jdisanti"
buildSrc/src/main/kotlin/CodegenTestCommon.kt +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ private fun generateSmithyBuild(projectDir: String, pluginName: String, tests: L "relativePath": "$projectDir/rust-runtime" }, "codegen": { "enableNewCrateOrganizationScheme": false "enableNewCrateOrganizationScheme": true }, "service": "${it.service}", "module": "${it.module}", Loading
codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustModule.kt +3 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ import software.amazon.smithy.model.traits.ErrorTrait import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientDocs import software.amazon.smithy.rust.codegen.client.smithy.generators.client.FluentClientGenerator import software.amazon.smithy.rust.codegen.core.rustlang.CargoDependency import software.amazon.smithy.rust.codegen.core.rustlang.EscapeFor import software.amazon.smithy.rust.codegen.core.rustlang.RustModule import software.amazon.smithy.rust.codegen.core.rustlang.RustReservedWords import software.amazon.smithy.rust.codegen.core.rustlang.Visibility Loading Loading @@ -149,7 +150,7 @@ class ClientModuleDocProvider( by calling the `customize()` method on the builder returned from a client operation call. For example, this can be used to add an additional HTTP header: ```no_run ```ignore ## async fn wrapper() -> Result<(), $moduleUseName::Error> { ## let client: $moduleUseName::Client = unimplemented!(); use #{http}::header::{HeaderName, HeaderValue}; Loading Loading @@ -217,7 +218,7 @@ object ClientModuleProvider : ModuleProvider { val operationShape = shape.findOperation(context.model) val contextName = operationShape.contextName(context.serviceShape) val operationModuleName = RustReservedWords.escapeIfNeeded(contextName.toSnakeCase()) RustReservedWords.escapeIfNeeded(contextName.toSnakeCase(), EscapeFor.ModuleName) return RustModule.public( operationModuleName, parent = ClientRustModule.Operation, Loading
codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustSettings.kt +2 −2 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ data class ClientCodegenConfig( private const val defaultIncludeFluentClient = true private const val defaultAddMessageToErrors = true private val defaultEventStreamAllowList: Set<String> = emptySet() private const val defaultEnableNewCrateOrganizationScheme = false private const val defaultEnableNewCrateOrganizationScheme = true fun fromCodegenConfigAndNode(coreCodegenConfig: CoreCodegenConfig, node: Optional<ObjectNode>) = if (node.isPresent) { Loading @@ -109,7 +109,7 @@ data class ClientCodegenConfig( renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", defaultRenameExceptions), includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", defaultIncludeFluentClient), addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", defaultAddMessageToErrors), enableNewCrateOrganizationScheme = node.get().getBooleanMemberOrDefault("enableNewCrateOrganizationScheme", false), enableNewCrateOrganizationScheme = node.get().getBooleanMemberOrDefault("enableNewCrateOrganizationScheme", defaultEnableNewCrateOrganizationScheme), ) } else { ClientCodegenConfig( Loading
codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/generators/error/ErrorGenerator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ class ErrorGenerator( override fun section(section: BuilderSection): Writable = writable { when (section) { is BuilderSection.AdditionalFields -> { rust("meta: Option<#T>,", errorMetadata(runtimeConfig)) rust("meta: std::option::Option<#T>,", errorMetadata(runtimeConfig)) } is BuilderSection.AdditionalMethods -> { Loading @@ -102,7 +102,7 @@ class ErrorGenerator( } /// Sets error metadata pub fn set_meta(&mut self, meta: Option<#{error_metadata}>) -> &mut Self { pub fn set_meta(&mut self, meta: std::option::Option<#{error_metadata}>) -> &mut Self { self.meta = meta; self } Loading