From 3068334c0b03945c518facbca5dc83eb013570f7 Mon Sep 17 00:00:00 2001 From: David Yaffe Date: Fri, 27 Dec 2024 12:01:08 -0500 Subject: [PATCH] shorten middleware names due to swiftlint --- ...RpcV2CborValidateResponseHeaderMiddleware.swift | 14 +++++++++----- .../rpcv2cbor/RpcV2CborProtocolGenerator.kt | 2 +- .../RpcV2CborValidateResponseHeaderIntegration.kt | 8 ++++---- .../codegen/swiftmodules/AWSClientRuntimeTypes.kt | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/RpcV2CborValidateResponseHeaderMiddleware.swift b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/RpcV2CborValidateResponseHeaderMiddleware.swift index 95fa31314fb..ae3a0009724 100644 --- a/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/RpcV2CborValidateResponseHeaderMiddleware.swift +++ b/Sources/Core/AWSClientRuntime/Sources/AWSClientRuntime/Middlewares/RpcV2CborValidateResponseHeaderMiddleware.swift @@ -8,8 +8,8 @@ import ClientRuntime import SmithyHTTPAPI -public struct RpcV2CborValidateResponseHeaderMiddleware { - public let id: Swift.String = "RpcV2CborValidateResponseHeaderMiddleware" +public struct CborValidateResponseHeaderMiddleware { + public let id: Swift.String = "CborValidateResponseHeaderMiddleware" public init() {} } @@ -19,7 +19,7 @@ public enum ServiceResponseError: Error { case badHeaderValue(String) } -extension RpcV2CborValidateResponseHeaderMiddleware: Interceptor { +extension CborValidateResponseHeaderMiddleware: Interceptor { public typealias InputType = Input public typealias OutputType = Output @@ -31,11 +31,15 @@ extension RpcV2CborValidateResponseHeaderMiddleware: Interceptor { let smithyProtocolHeader = response.headers.value(for: "smithy-protocol") guard let smithyProtocolHeader else { - throw ServiceResponseError.missingHeader("smithy-protocol header is missing from a response over RpcV2 Cbor!") + throw ServiceResponseError.missingHeader( + "smithy-protocol header is missing from a response over RpcV2 Cbor!" + ) } guard smithyProtocolHeader == "rpc-v2-cbor" else { - throw ServiceResponseError.badHeaderValue("smithy-protocol header is set to \(smithyProtocolHeader) instead of expected value rpc-v2-cbor") + throw ServiceResponseError.badHeaderValue( + "smithy-protocol header is set to \(smithyProtocolHeader) instead of expected value rpc-v2-cbor" + ) } } } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborProtocolGenerator.kt index f9d81fedc21..4de74116153 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborProtocolGenerator.kt @@ -61,7 +61,7 @@ class RpcV2CborProtocolGenerator : AWSHTTPBindingProtocolGenerator(RpcV2CborCust ) operationMiddleware.appendMiddleware(operation, smithyProtocolRequestHeaderMiddleware) - operationMiddleware.appendMiddleware(operation, RpcV2CborValidateResponseHeaderMiddleware) + operationMiddleware.appendMiddleware(operation, CborValidateResponseHeaderMiddleware) if (operation.hasHttpBody(ctx)) { operationMiddleware.appendMiddleware(operation, ContentTypeMiddleware(ctx.model, ctx.symbolProvider, contentTypeValue, true)) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborValidateResponseHeaderIntegration.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborValidateResponseHeaderIntegration.kt index 11f8f747dc8..c7f01b13165 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborValidateResponseHeaderIntegration.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/protocols/rpcv2cbor/RpcV2CborValidateResponseHeaderIntegration.kt @@ -13,14 +13,14 @@ import software.amazon.smithy.swift.codegen.integration.middlewares.handlers.Mid import software.amazon.smithy.swift.codegen.middleware.MiddlewareRenderable import software.amazon.smithy.swift.codegen.model.shapes -class RpcV2CborValidateResponseHeaderIntegration : SwiftIntegration { +class CborValidateResponseHeaderIntegration : SwiftIntegration { override fun enabledForService(model: Model, settings: SwiftSettings): Boolean = model .shapes() .any { it.hasTrait(Rpcv2CborTrait::class.java) } } -object RpcV2CborValidateResponseHeaderMiddleware : MiddlewareRenderable { - override val name = "RpcV2CborValidateResponseHeaderMiddleware" +object CborValidateResponseHeaderMiddleware : MiddlewareRenderable { + override val name = "CborValidateResponseHeaderMiddleware" override fun renderMiddlewareInit( ctx: ProtocolGenerator.GenerationContext, @@ -31,7 +31,7 @@ object RpcV2CborValidateResponseHeaderMiddleware : MiddlewareRenderable { val outputShapeName = MiddlewareShapeUtils.outputSymbol(ctx.symbolProvider, ctx.model, op).name writer.write( "\$N<\$L, \$L>()", - AWSClientRuntimeTypes.RpcV2Cbor.RpcV2CborValidateResponseHeaderMiddleware, + AWSClientRuntimeTypes.RpcV2Cbor.CborValidateResponseHeaderMiddleware, inputShapeName, outputShapeName, ) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftmodules/AWSClientRuntimeTypes.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftmodules/AWSClientRuntimeTypes.kt index c9964bc3be1..b7ae7a89281 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftmodules/AWSClientRuntimeTypes.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/swiftmodules/AWSClientRuntimeTypes.kt @@ -31,7 +31,7 @@ object AWSClientRuntimeTypes { object RpcV2Cbor { val RpcV2CborError = runtimeSymbol("RpcV2CborError", SwiftDeclaration.STRUCT, listOf("SmithyReadWrite")) - val RpcV2CborValidateResponseHeaderMiddleware = runtimeSymbol("RpcV2CborValidateResponseHeaderMiddleware", SwiftDeclaration.STRUCT) + val CborValidateResponseHeaderMiddleware = runtimeSymbol("CborValidateResponseHeaderMiddleware", SwiftDeclaration.STRUCT) } object Core {