From 325ecff3f3a029477b52fa2388751d5697c490ec Mon Sep 17 00:00:00 2001 From: Ganesh Jangir Date: Mon, 7 Nov 2022 16:00:00 -0800 Subject: [PATCH 1/2] fix!: update shape and member extensions to use same casing as rest of the system --- AWSClientRuntime/Sources/AWSClientConfiguration.swift | 2 +- .../amazon/smithy/aws/swift/codegen/AWSServiceConfig.kt | 2 +- .../awsjson/AWSJsonHttpResponseBindingErrorGenerator.kt | 4 ++-- .../AWSEc2QueryHttpResponseBindingErrorGenerator.kt | 4 ++-- .../AWSRestJson1HttpResponseBindingErrorGeneratable.kt | 4 ++-- .../restxml/AWSRestXMLHttpResponseBindingErrorGenerator.kt | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/AWSClientRuntime/Sources/AWSClientConfiguration.swift b/AWSClientRuntime/Sources/AWSClientConfiguration.swift index 6d5cbfc192e..49f75f68edf 100644 --- a/AWSClientRuntime/Sources/AWSClientConfiguration.swift +++ b/AWSClientRuntime/Sources/AWSClientConfiguration.swift @@ -11,7 +11,7 @@ public protocol AWSRuntimeConfiguration { var signingRegion: String? {get set} var regionResolver: RegionResolver? {get set} var frameworkMetadata: FrameworkMetadata? {get set} - var useFips: Bool? {get set} + var useFIPS: Bool? {get set} var useDualStack: Bool? {get set} } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSServiceConfig.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSServiceConfig.kt index e005a1e27fc..96ef5d67f41 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSServiceConfig.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSServiceConfig.kt @@ -25,7 +25,7 @@ const val FRAMEWORK_METADATA = "frameworkMetadata" const val REGION_CONFIG_NAME = "region" const val REGION_RESOLVER = "regionResolver" const val SIGNING_REGION_CONFIG_NAME = "signingRegion" -const val USE_FIPS_CONFIG_NAME = "useFips" +const val USE_FIPS_CONFIG_NAME = "useFIPS" const val USE_DUAL_STACK_CONFIG_NAME = "useDualStack" const val RUNTIME_CONFIG_NAME = "runtimeConfig" const val ENDPOINT_CONFIG_NAME = "endpoint" diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGenerator.kt index c78c004e94c..051d46ac97b 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AWSJsonHttpResponseBindingErrorGenerator.kt @@ -13,7 +13,7 @@ import software.amazon.smithy.swift.codegen.ClientRuntimeTypes import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.httpResponse.HttpResponseBindingErrorGeneratable -import software.amazon.smithy.swift.codegen.model.capitalizedName +import software.amazon.smithy.swift.codegen.model.toUpperCamelCase /* * TODO: The code below is not valid for AWS Json 1.0/1.1. @@ -21,7 +21,7 @@ import software.amazon.smithy.swift.codegen.model.capitalizedName */ class AWSJsonHttpResponseBindingErrorGenerator : HttpResponseBindingErrorGeneratable { override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape) { - val operationErrorName = "${op.capitalizedName()}OutputError" + val operationErrorName = "${op.toUpperCamelCase()}OutputError" val rootNamespace = ctx.settings.moduleName val httpBindingSymbol = Symbol.builder() .definitionFile("./$rootNamespace/models/$operationErrorName+HttpResponseBinding.swift") diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/httpResponse/AWSEc2QueryHttpResponseBindingErrorGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/httpResponse/AWSEc2QueryHttpResponseBindingErrorGenerator.kt index 0ce918e033b..affe514b8f8 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/httpResponse/AWSEc2QueryHttpResponseBindingErrorGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/httpResponse/AWSEc2QueryHttpResponseBindingErrorGenerator.kt @@ -12,11 +12,11 @@ import software.amazon.smithy.swift.codegen.ClientRuntimeTypes import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.httpResponse.HttpResponseBindingErrorGeneratable -import software.amazon.smithy.swift.codegen.model.capitalizedName +import software.amazon.smithy.swift.codegen.model.toUpperCamelCase class AWSEc2QueryHttpResponseBindingErrorGenerator : HttpResponseBindingErrorGeneratable { override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape) { - val operationErrorName = "${op.capitalizedName()}OutputError" + val operationErrorName = "${op.toUpperCamelCase()}OutputError" val rootNamespace = ctx.settings.moduleName val httpBindingSymbol = Symbol.builder() .definitionFile("./$rootNamespace/models/$operationErrorName+HttpResponseBinding.swift") diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1HttpResponseBindingErrorGeneratable.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1HttpResponseBindingErrorGeneratable.kt index 6c23fe9ee33..886f5871b41 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1HttpResponseBindingErrorGeneratable.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1HttpResponseBindingErrorGeneratable.kt @@ -13,11 +13,11 @@ import software.amazon.smithy.swift.codegen.ClientRuntimeTypes import software.amazon.smithy.swift.codegen.SwiftDependency import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.httpResponse.HttpResponseBindingErrorGeneratable -import software.amazon.smithy.swift.codegen.model.capitalizedName +import software.amazon.smithy.swift.codegen.model.toUpperCamelCase class AWSRestJson1HttpResponseBindingErrorGeneratable : HttpResponseBindingErrorGeneratable { override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape) { - val operationErrorName = "${op.capitalizedName()}OutputError" + val operationErrorName = "${op.toUpperCamelCase()}OutputError" val rootNamespace = ctx.settings.moduleName val httpBindingSymbol = Symbol.builder() .definitionFile("./$rootNamespace/models/$operationErrorName+HttpResponseBinding.swift") diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGenerator.kt index be76f1426b6..0ccc23ea78b 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/AWSRestXMLHttpResponseBindingErrorGenerator.kt @@ -15,14 +15,14 @@ import software.amazon.smithy.swift.codegen.declareSection import software.amazon.smithy.swift.codegen.integration.ProtocolGenerator import software.amazon.smithy.swift.codegen.integration.SectionId import software.amazon.smithy.swift.codegen.integration.httpResponse.HttpResponseBindingErrorGeneratable -import software.amazon.smithy.swift.codegen.model.capitalizedName +import software.amazon.smithy.swift.codegen.model.toUpperCamelCase class AWSRestXMLHttpResponseBindingErrorGenerator : HttpResponseBindingErrorGeneratable { object RestXMLResponseBindingSectionId : SectionId override fun render(ctx: ProtocolGenerator.GenerationContext, op: OperationShape) { - val operationErrorName = "${op.capitalizedName()}OutputError" + val operationErrorName = "${op.toUpperCamelCase()}OutputError" val rootNamespace = ctx.settings.moduleName val httpBindingSymbol = Symbol.builder() .definitionFile("./$rootNamespace/models/$operationErrorName+HttpResponseBinding.swift") From 4c580cb1dfd16dc70d763f0e7c25c46624c98509 Mon Sep 17 00:00:00 2001 From: Ganesh Jangir Date: Mon, 7 Nov 2022 17:37:50 -0800 Subject: [PATCH 2/2] fix test case --- .../codegen/RestJsonProtocolGeneratorTests.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/RestJsonProtocolGeneratorTests.kt b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/RestJsonProtocolGeneratorTests.kt index 74894530be5..c622ec0afa5 100644 --- a/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/RestJsonProtocolGeneratorTests.kt +++ b/codegen/smithy-aws-swift-codegen/src/test/kotlin/software/amazon/smithy/aws/swift/codegen/RestJsonProtocolGeneratorTests.kt @@ -128,7 +128,7 @@ class RestJsonProtocolGeneratorTests { public var regionResolver: AWSClientRuntime.RegionResolver? public var signingRegion: Swift.String? public var useDualStack: Swift.Bool? - public var useFips: Swift.Bool? + public var useFIPS: Swift.Bool? public var endpointResolver: EndpointResolver @@ -142,7 +142,7 @@ class RestJsonProtocolGeneratorTests { runtimeConfig: ClientRuntime.SDKRuntimeConfiguration, signingRegion: Swift.String? = nil, useDualStack: Swift.Bool? = nil, - useFips: Swift.Bool? = nil + useFIPS: Swift.Bool? = nil ) throws { if let credProvider = credentialsProvider { self.credentialsProvider = try AWSClientRuntime.AWSCredentialsProvider.fromCustom(credProvider) @@ -160,7 +160,7 @@ class RestJsonProtocolGeneratorTests { self.regionResolver = regionResolver ?? DefaultRegionResolver() self.signingRegion = signingRegion ?? region self.useDualStack = useDualStack - self.useFips = useFips + self.useFIPS = useFIPS self.clientLogMode = runtimeConfig.clientLogMode self.decoder = runtimeConfig.decoder self.encoder = runtimeConfig.encoder @@ -180,7 +180,7 @@ class RestJsonProtocolGeneratorTests { regionResolver: AWSClientRuntime.RegionResolver? = nil, signingRegion: Swift.String? = nil, useDualStack: Swift.Bool? = nil, - useFips: Swift.Bool? = nil + useFIPS: Swift.Bool? = nil ) throws { let runtimeConfig = try ClientRuntime.DefaultSDKRuntimeConfiguration("ExampleClient") try self.init( @@ -193,7 +193,7 @@ class RestJsonProtocolGeneratorTests { runtimeConfig: runtimeConfig, signingRegion: signingRegion, useDualStack: useDualStack, - useFips: useFips + useFIPS: useFIPS ) } @@ -206,7 +206,7 @@ class RestJsonProtocolGeneratorTests { runtimeConfig: ClientRuntime.SDKRuntimeConfiguration, signingRegion: Swift.String? = nil, useDualStack: Swift.Bool? = nil, - useFips: Swift.Bool? = nil + useFIPS: Swift.Bool? = nil ) async throws { if let credProvider = credentialsProvider { self.credentialsProvider = try AWSClientRuntime.AWSCredentialsProvider.fromCustom(credProvider) @@ -225,7 +225,7 @@ class RestJsonProtocolGeneratorTests { self.regionResolver = regionResolver ?? DefaultRegionResolver() self.signingRegion = signingRegion ?? region self.useDualStack = useDualStack - self.useFips = useFips + self.useFIPS = useFIPS self.clientLogMode = runtimeConfig.clientLogMode self.decoder = runtimeConfig.decoder self.encoder = runtimeConfig.encoder @@ -244,7 +244,7 @@ class RestJsonProtocolGeneratorTests { regionResolver: AWSClientRuntime.RegionResolver? = nil, signingRegion: Swift.String? = nil, useDualStack: Swift.Bool? = nil, - useFips: Swift.Bool? = nil + useFIPS: Swift.Bool? = nil ) async throws { let runtimeConfig = try ClientRuntime.DefaultSDKRuntimeConfiguration("ExampleClient") try await self.init( @@ -256,7 +256,7 @@ class RestJsonProtocolGeneratorTests { runtimeConfig: runtimeConfig, signingRegion: signingRegion, useDualStack: useDualStack, - useFips: useFips + useFIPS: useFIPS ) }