Loading aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RegionDecorator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ class RegionProviderConfig(codegenContext: ClientCodegenContext) : ConfigCustomi } is ServiceConfig.BuilderFromConfigBag -> { rustTemplate("${section.builder}.set_region(${section.config_bag}.load::<#{Region}>().cloned());", *codegenScope) rustTemplate("${section.builder}.set_region(${section.configBag}.load::<#{Region}>().cloned());", *codegenScope) } else -> emptySection Loading aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,7 @@ class UserAgentDecorator : ClientCodegenDecorator { is ServiceConfig.BuilderFromConfigBag -> writable { rustTemplate("${section.builder}.set_app_name(${section.config_bag}.load::<#{AppName}>().cloned());", *codegenScope) rustTemplate("${section.builder}.set_app_name(${section.configBag}.load::<#{AppName}>().cloned());", *codegenScope) } is ServiceConfig.BuilderBuild -> Loading buildSrc/src/main/kotlin/CodegenTestCommon.kt +4 −4 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ fun Project.registerGenerateSmithyBuildTask( // If this is a rebuild, cache all the hashes of the generated Rust files. These are later used by the // `modifyMtime` task. project.extra[previousBuildHashesKey] = project.extra[PREVIOUS_BUILD_HASHES_KEY] = project.buildDir.walk() .filter { it.isFile } .map { Loading Loading @@ -217,7 +217,7 @@ fun Project.registerGenerateCargoConfigTomlTask(outputDir: File) { } } const val previousBuildHashesKey = "previousBuildHashes" const val PREVIOUS_BUILD_HASHES_KEY = "previousBuildHashes" fun Project.registerModifyMtimeTask() { // Cargo uses `mtime` (among other factors) to determine whether a compilation unit needs a rebuild. While developing, Loading @@ -232,11 +232,11 @@ fun Project.registerModifyMtimeTask() { dependsOn("generateSmithyBuild") doFirst { if (!project.extra.has(previousBuildHashesKey)) { if (!project.extra.has(PREVIOUS_BUILD_HASHES_KEY)) { println("No hashes from a previous build exist because `generateSmithyBuild` is up to date, skipping `mtime` fixups") } else { @Suppress("UNCHECKED_CAST") val previousBuildHashes: Map<String, Long> = project.extra[previousBuildHashesKey] as Map<String, Long> val previousBuildHashes: Map<String, Long> = project.extra[PREVIOUS_BUILD_HASHES_KEY] as Map<String, Long> project.buildDir.walk() .filter { it.isFile } Loading codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientReservedWords.kt +2 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ val ClientReservedWords = mapOf( // Unions contain an `Unknown` variant. This exists to support parsing data returned from the server // that represent union variants that have been added since this SDK was generated. UnionGenerator.UnknownVariantName to "${UnionGenerator.UnknownVariantName}Value", "${UnionGenerator.UnknownVariantName}Value" to "${UnionGenerator.UnknownVariantName}Value_", UnionGenerator.UNKNOWN_VARIANT_NAME to "${UnionGenerator.UNKNOWN_VARIANT_NAME}Value", "${UnionGenerator.UNKNOWN_VARIANT_NAME}Value" to "${UnionGenerator.UNKNOWN_VARIANT_NAME}Value_", ), enumMemberMap = mapOf( Loading codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustSettings.kt +27 −27 Original line number Diff line number Diff line Loading @@ -86,32 +86,32 @@ data class ClientRustSettings( * [addMessageToErrors]: Adds a `message` field automatically to all error shapes */ data class ClientCodegenConfig( override val formatTimeoutSeconds: Int = defaultFormatTimeoutSeconds, override val debugMode: Boolean = defaultDebugMode, override val flattenCollectionAccessors: Boolean = defaultFlattenAccessors, override val formatTimeoutSeconds: Int = DEFAULT_FORMAT_TIMEOUT_SECONDS, override val debugMode: Boolean = DEFAULT_DEBUG_MODE, override val flattenCollectionAccessors: Boolean = DEFAULT_FLATTEN_ACCESSORS, val nullabilityCheckMode: NullableIndex.CheckMode = NullableIndex.CheckMode.CLIENT, val renameExceptions: Boolean = defaultRenameExceptions, val includeFluentClient: Boolean = defaultIncludeFluentClient, val addMessageToErrors: Boolean = defaultAddMessageToErrors, val renameExceptions: Boolean = DEFAULT_RENAME_EXCEPTIONS, val includeFluentClient: Boolean = DEFAULT_INCLUDE_FLUENT_CLIENT, val addMessageToErrors: Boolean = DEFAULT_ADD_MESSAGE_TO_ERRORS, // TODO(EventStream): [CLEANUP] Remove this property when turning on Event Stream for all services val eventStreamAllowList: Set<String> = defaultEventStreamAllowList, val eventStreamAllowList: Set<String> = DEFAULT_EVENT_STREAM_ALLOW_LIST, /** If true, adds `endpoint_url`/`set_endpoint_url` methods to the service config */ val includeEndpointUrlConfig: Boolean = defaultIncludeEndpointUrlConfig, val enableUserConfigurableRuntimePlugins: Boolean = defaultEnableUserConfigurableRuntimePlugins, val includeEndpointUrlConfig: Boolean = DEFAULT_INCLUDE_ENDPOINT_URL_CONFIG, val enableUserConfigurableRuntimePlugins: Boolean = DEFAULT_ENABLE_USER_CONFIGURABLE_RUNTIME_PLUGINS, ) : CoreCodegenConfig( formatTimeoutSeconds, debugMode, defaultFlattenAccessors, formatTimeoutSeconds, debugMode, DEFAULT_FLATTEN_ACCESSORS, ) { companion object { private const val defaultRenameExceptions = true private const val defaultIncludeFluentClient = true private const val defaultAddMessageToErrors = true private val defaultEventStreamAllowList: Set<String> = emptySet() private const val defaultIncludeEndpointUrlConfig = true private const val defaultEnableUserConfigurableRuntimePlugins = true private const val defaultNullabilityCheckMode = "CLIENT" private const val DEFAULT_RENAME_EXCEPTIONS = true private const val DEFAULT_INCLUDE_FLUENT_CLIENT = true private const val DEFAULT_ADD_MESSAGE_TO_ERRORS = true private val DEFAULT_EVENT_STREAM_ALLOW_LIST: Set<String> = emptySet() private const val DEFAULT_INCLUDE_ENDPOINT_URL_CONFIG = true private const val DEFAULT_ENABLE_USER_CONFIGURABLE_RUNTIME_PLUGINS = true private const val DEFAULT_NULLABILITY_CHECK_MODE = "CLIENT" // Note: only clients default to true, servers default to false private const val defaultFlattenAccessors = true private const val DEFAULT_FLATTEN_ACCESSORS = true fun fromCodegenConfigAndNode( coreCodegenConfig: CoreCodegenConfig, Loading @@ -119,26 +119,26 @@ data class ClientCodegenConfig( ) = if (node.isPresent) { ClientCodegenConfig( formatTimeoutSeconds = coreCodegenConfig.formatTimeoutSeconds, flattenCollectionAccessors = node.get().getBooleanMemberOrDefault("flattenCollectionAccessors", defaultFlattenAccessors), flattenCollectionAccessors = node.get().getBooleanMemberOrDefault("flattenCollectionAccessors", DEFAULT_FLATTEN_ACCESSORS), debugMode = coreCodegenConfig.debugMode, eventStreamAllowList = node.get().getArrayMember("eventStreamAllowList").map { array -> array.toList().mapNotNull { node -> node.asStringNode().orNull()?.value } }.orNull()?.toSet() ?: defaultEventStreamAllowList, renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", defaultRenameExceptions), includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", defaultIncludeFluentClient), addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", defaultAddMessageToErrors), includeEndpointUrlConfig = node.get().getBooleanMemberOrDefault("includeEndpointUrlConfig", defaultIncludeEndpointUrlConfig), enableUserConfigurableRuntimePlugins = node.get().getBooleanMemberOrDefault("enableUserConfigurableRuntimePlugins", defaultEnableUserConfigurableRuntimePlugins), nullabilityCheckMode = NullableIndex.CheckMode.valueOf(node.get().getStringMemberOrDefault("nullabilityCheckMode", defaultNullabilityCheckMode)), }.orNull()?.toSet() ?: DEFAULT_EVENT_STREAM_ALLOW_LIST, renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", DEFAULT_RENAME_EXCEPTIONS), includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", DEFAULT_INCLUDE_FLUENT_CLIENT), addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", DEFAULT_ADD_MESSAGE_TO_ERRORS), includeEndpointUrlConfig = node.get().getBooleanMemberOrDefault("includeEndpointUrlConfig", DEFAULT_INCLUDE_ENDPOINT_URL_CONFIG), enableUserConfigurableRuntimePlugins = node.get().getBooleanMemberOrDefault("enableUserConfigurableRuntimePlugins", DEFAULT_ENABLE_USER_CONFIGURABLE_RUNTIME_PLUGINS), nullabilityCheckMode = NullableIndex.CheckMode.valueOf(node.get().getStringMemberOrDefault("nullabilityCheckMode", DEFAULT_NULLABILITY_CHECK_MODE)), ) } else { ClientCodegenConfig( formatTimeoutSeconds = coreCodegenConfig.formatTimeoutSeconds, debugMode = coreCodegenConfig.debugMode, nullabilityCheckMode = NullableIndex.CheckMode.valueOf(defaultNullabilityCheckMode), nullabilityCheckMode = NullableIndex.CheckMode.valueOf(DEFAULT_NULLABILITY_CHECK_MODE), ) } } Loading Loading
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/RegionDecorator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ class RegionProviderConfig(codegenContext: ClientCodegenContext) : ConfigCustomi } is ServiceConfig.BuilderFromConfigBag -> { rustTemplate("${section.builder}.set_region(${section.config_bag}.load::<#{Region}>().cloned());", *codegenScope) rustTemplate("${section.builder}.set_region(${section.configBag}.load::<#{Region}>().cloned());", *codegenScope) } else -> emptySection Loading
aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/UserAgentDecorator.kt +1 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,7 @@ class UserAgentDecorator : ClientCodegenDecorator { is ServiceConfig.BuilderFromConfigBag -> writable { rustTemplate("${section.builder}.set_app_name(${section.config_bag}.load::<#{AppName}>().cloned());", *codegenScope) rustTemplate("${section.builder}.set_app_name(${section.configBag}.load::<#{AppName}>().cloned());", *codegenScope) } is ServiceConfig.BuilderBuild -> Loading
buildSrc/src/main/kotlin/CodegenTestCommon.kt +4 −4 Original line number Diff line number Diff line Loading @@ -174,7 +174,7 @@ fun Project.registerGenerateSmithyBuildTask( // If this is a rebuild, cache all the hashes of the generated Rust files. These are later used by the // `modifyMtime` task. project.extra[previousBuildHashesKey] = project.extra[PREVIOUS_BUILD_HASHES_KEY] = project.buildDir.walk() .filter { it.isFile } .map { Loading Loading @@ -217,7 +217,7 @@ fun Project.registerGenerateCargoConfigTomlTask(outputDir: File) { } } const val previousBuildHashesKey = "previousBuildHashes" const val PREVIOUS_BUILD_HASHES_KEY = "previousBuildHashes" fun Project.registerModifyMtimeTask() { // Cargo uses `mtime` (among other factors) to determine whether a compilation unit needs a rebuild. While developing, Loading @@ -232,11 +232,11 @@ fun Project.registerModifyMtimeTask() { dependsOn("generateSmithyBuild") doFirst { if (!project.extra.has(previousBuildHashesKey)) { if (!project.extra.has(PREVIOUS_BUILD_HASHES_KEY)) { println("No hashes from a previous build exist because `generateSmithyBuild` is up to date, skipping `mtime` fixups") } else { @Suppress("UNCHECKED_CAST") val previousBuildHashes: Map<String, Long> = project.extra[previousBuildHashesKey] as Map<String, Long> val previousBuildHashes: Map<String, Long> = project.extra[PREVIOUS_BUILD_HASHES_KEY] as Map<String, Long> project.buildDir.walk() .filter { it.isFile } Loading
codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientReservedWords.kt +2 −2 Original line number Diff line number Diff line Loading @@ -26,8 +26,8 @@ val ClientReservedWords = mapOf( // Unions contain an `Unknown` variant. This exists to support parsing data returned from the server // that represent union variants that have been added since this SDK was generated. UnionGenerator.UnknownVariantName to "${UnionGenerator.UnknownVariantName}Value", "${UnionGenerator.UnknownVariantName}Value" to "${UnionGenerator.UnknownVariantName}Value_", UnionGenerator.UNKNOWN_VARIANT_NAME to "${UnionGenerator.UNKNOWN_VARIANT_NAME}Value", "${UnionGenerator.UNKNOWN_VARIANT_NAME}Value" to "${UnionGenerator.UNKNOWN_VARIANT_NAME}Value_", ), enumMemberMap = mapOf( Loading
codegen-client/src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientRustSettings.kt +27 −27 Original line number Diff line number Diff line Loading @@ -86,32 +86,32 @@ data class ClientRustSettings( * [addMessageToErrors]: Adds a `message` field automatically to all error shapes */ data class ClientCodegenConfig( override val formatTimeoutSeconds: Int = defaultFormatTimeoutSeconds, override val debugMode: Boolean = defaultDebugMode, override val flattenCollectionAccessors: Boolean = defaultFlattenAccessors, override val formatTimeoutSeconds: Int = DEFAULT_FORMAT_TIMEOUT_SECONDS, override val debugMode: Boolean = DEFAULT_DEBUG_MODE, override val flattenCollectionAccessors: Boolean = DEFAULT_FLATTEN_ACCESSORS, val nullabilityCheckMode: NullableIndex.CheckMode = NullableIndex.CheckMode.CLIENT, val renameExceptions: Boolean = defaultRenameExceptions, val includeFluentClient: Boolean = defaultIncludeFluentClient, val addMessageToErrors: Boolean = defaultAddMessageToErrors, val renameExceptions: Boolean = DEFAULT_RENAME_EXCEPTIONS, val includeFluentClient: Boolean = DEFAULT_INCLUDE_FLUENT_CLIENT, val addMessageToErrors: Boolean = DEFAULT_ADD_MESSAGE_TO_ERRORS, // TODO(EventStream): [CLEANUP] Remove this property when turning on Event Stream for all services val eventStreamAllowList: Set<String> = defaultEventStreamAllowList, val eventStreamAllowList: Set<String> = DEFAULT_EVENT_STREAM_ALLOW_LIST, /** If true, adds `endpoint_url`/`set_endpoint_url` methods to the service config */ val includeEndpointUrlConfig: Boolean = defaultIncludeEndpointUrlConfig, val enableUserConfigurableRuntimePlugins: Boolean = defaultEnableUserConfigurableRuntimePlugins, val includeEndpointUrlConfig: Boolean = DEFAULT_INCLUDE_ENDPOINT_URL_CONFIG, val enableUserConfigurableRuntimePlugins: Boolean = DEFAULT_ENABLE_USER_CONFIGURABLE_RUNTIME_PLUGINS, ) : CoreCodegenConfig( formatTimeoutSeconds, debugMode, defaultFlattenAccessors, formatTimeoutSeconds, debugMode, DEFAULT_FLATTEN_ACCESSORS, ) { companion object { private const val defaultRenameExceptions = true private const val defaultIncludeFluentClient = true private const val defaultAddMessageToErrors = true private val defaultEventStreamAllowList: Set<String> = emptySet() private const val defaultIncludeEndpointUrlConfig = true private const val defaultEnableUserConfigurableRuntimePlugins = true private const val defaultNullabilityCheckMode = "CLIENT" private const val DEFAULT_RENAME_EXCEPTIONS = true private const val DEFAULT_INCLUDE_FLUENT_CLIENT = true private const val DEFAULT_ADD_MESSAGE_TO_ERRORS = true private val DEFAULT_EVENT_STREAM_ALLOW_LIST: Set<String> = emptySet() private const val DEFAULT_INCLUDE_ENDPOINT_URL_CONFIG = true private const val DEFAULT_ENABLE_USER_CONFIGURABLE_RUNTIME_PLUGINS = true private const val DEFAULT_NULLABILITY_CHECK_MODE = "CLIENT" // Note: only clients default to true, servers default to false private const val defaultFlattenAccessors = true private const val DEFAULT_FLATTEN_ACCESSORS = true fun fromCodegenConfigAndNode( coreCodegenConfig: CoreCodegenConfig, Loading @@ -119,26 +119,26 @@ data class ClientCodegenConfig( ) = if (node.isPresent) { ClientCodegenConfig( formatTimeoutSeconds = coreCodegenConfig.formatTimeoutSeconds, flattenCollectionAccessors = node.get().getBooleanMemberOrDefault("flattenCollectionAccessors", defaultFlattenAccessors), flattenCollectionAccessors = node.get().getBooleanMemberOrDefault("flattenCollectionAccessors", DEFAULT_FLATTEN_ACCESSORS), debugMode = coreCodegenConfig.debugMode, eventStreamAllowList = node.get().getArrayMember("eventStreamAllowList").map { array -> array.toList().mapNotNull { node -> node.asStringNode().orNull()?.value } }.orNull()?.toSet() ?: defaultEventStreamAllowList, renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", defaultRenameExceptions), includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", defaultIncludeFluentClient), addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", defaultAddMessageToErrors), includeEndpointUrlConfig = node.get().getBooleanMemberOrDefault("includeEndpointUrlConfig", defaultIncludeEndpointUrlConfig), enableUserConfigurableRuntimePlugins = node.get().getBooleanMemberOrDefault("enableUserConfigurableRuntimePlugins", defaultEnableUserConfigurableRuntimePlugins), nullabilityCheckMode = NullableIndex.CheckMode.valueOf(node.get().getStringMemberOrDefault("nullabilityCheckMode", defaultNullabilityCheckMode)), }.orNull()?.toSet() ?: DEFAULT_EVENT_STREAM_ALLOW_LIST, renameExceptions = node.get().getBooleanMemberOrDefault("renameErrors", DEFAULT_RENAME_EXCEPTIONS), includeFluentClient = node.get().getBooleanMemberOrDefault("includeFluentClient", DEFAULT_INCLUDE_FLUENT_CLIENT), addMessageToErrors = node.get().getBooleanMemberOrDefault("addMessageToErrors", DEFAULT_ADD_MESSAGE_TO_ERRORS), includeEndpointUrlConfig = node.get().getBooleanMemberOrDefault("includeEndpointUrlConfig", DEFAULT_INCLUDE_ENDPOINT_URL_CONFIG), enableUserConfigurableRuntimePlugins = node.get().getBooleanMemberOrDefault("enableUserConfigurableRuntimePlugins", DEFAULT_ENABLE_USER_CONFIGURABLE_RUNTIME_PLUGINS), nullabilityCheckMode = NullableIndex.CheckMode.valueOf(node.get().getStringMemberOrDefault("nullabilityCheckMode", DEFAULT_NULLABILITY_CHECK_MODE)), ) } else { ClientCodegenConfig( formatTimeoutSeconds = coreCodegenConfig.formatTimeoutSeconds, debugMode = coreCodegenConfig.debugMode, nullabilityCheckMode = NullableIndex.CheckMode.valueOf(defaultNullabilityCheckMode), nullabilityCheckMode = NullableIndex.CheckMode.valueOf(DEFAULT_NULLABILITY_CHECK_MODE), ) } } Loading