From a5fe0eac6ae55cd902e01b1e7d8e6da3f2d64c32 Mon Sep 17 00:00:00 2001 From: David Yaffe Date: Mon, 11 Dec 2023 13:08:32 -0500 Subject: [PATCH 1/3] update smithy to 1.42.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f927f088d02..5bdc72faa84 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx4096M # codegen -smithyVersion=1.39.0 +smithyVersion=1.42.0 smithyGradleVersion=0.6.0 smithySwiftVersion = 0.1.0 From a22eedd0a9e952e4583a67af9c35a08cf2ac7dc2 Mon Sep 17 00:00:00 2001 From: David Yaffe Date: Tue, 12 Dec 2023 16:37:46 -0500 Subject: [PATCH 2/3] add exclusion for 'defaults' tag --- codegen/protocol-test-codegen/build.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codegen/protocol-test-codegen/build.gradle.kts b/codegen/protocol-test-codegen/build.gradle.kts index 58172379cb9..08487828003 100644 --- a/codegen/protocol-test-codegen/build.gradle.kts +++ b/codegen/protocol-test-codegen/build.gradle.kts @@ -103,6 +103,12 @@ fun generateSmithyBuild(tests: List): String { "${test.serviceShapeId}" ] } + }, + { + "name": "excludeTraitsByTag", + "args": { + "tags": ["defaults"] + } } ], "plugins": { From d58d8da83e4303598f922e4ba85c84e161385806 Mon Sep 17 00:00:00 2001 From: David Yaffe Date: Wed, 13 Dec 2023 13:13:08 -0500 Subject: [PATCH 3/3] add ability to exclude protocol tests by tag 'defaults' --- codegen/protocol-test-codegen/build.gradle.kts | 6 ------ .../aws/swift/codegen/AWSHttpBindingProtocolGenerator.kt | 4 +++- .../codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt | 5 +++-- .../codegen/awsjson/AwsJson1_1_ProtocolGenerator.kt | 5 +++-- .../swift/codegen/awsquery/AwsQueryProtocolGenerator.kt | 9 +++++---- .../swift/codegen/ec2query/Ec2QueryProtocolGenerator.kt | 9 +++++---- .../codegen/restjson/AWSRestJson1ProtocolGenerator.kt | 5 +++-- .../swift/codegen/restxml/RestXmlProtocolGenerator.kt | 9 +++++---- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/codegen/protocol-test-codegen/build.gradle.kts b/codegen/protocol-test-codegen/build.gradle.kts index 08487828003..58172379cb9 100644 --- a/codegen/protocol-test-codegen/build.gradle.kts +++ b/codegen/protocol-test-codegen/build.gradle.kts @@ -103,12 +103,6 @@ fun generateSmithyBuild(tests: List): String { "${test.serviceShapeId}" ] } - }, - { - "name": "excludeTraitsByTag", - "args": { - "tags": ["defaults"] - } } ], "plugins": { diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSHttpBindingProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSHttpBindingProtocolGenerator.kt index 704664f02af..d57b3b6cdb2 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSHttpBindingProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/AWSHttpBindingProtocolGenerator.kt @@ -53,6 +53,7 @@ abstract class AWSHttpBindingProtocolGenerator : HttpBindingProtocolGenerator() val responseTestBuilder = HttpProtocolUnitTestResponseGenerator.Builder() val errorTestBuilder = HttpProtocolUnitTestErrorGenerator.Builder() open val testsToIgnore: Set = setOf() + open val tagsToIgnore: Set = setOf() override val shouldRenderDecodableBodyStructForInputShapes = true override val shouldRenderCodingKeysForEncodable = true @@ -69,7 +70,8 @@ abstract class AWSHttpBindingProtocolGenerator : HttpBindingProtocolGenerator() getProtocolHttpBindingResolver(ctx, defaultContentType), serdeContext, imports, - testsToIgnore + testsToIgnore, + tagsToIgnore, ).generateProtocolTests() + renderEndpointsTests(ctx) } diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt index b74b2f3f897..c68d8e2aa3e 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_0_ProtocolGenerator.kt @@ -32,15 +32,16 @@ open class AwsJson1_0_ProtocolGenerator : AWSHttpBindingProtocolGenerator() { override val httpResponseGenerator = HttpResponseGenerator( unknownServiceErrorSymbol, defaultTimestampFormat, - AWSJsonHttpResponseBindingErrorGenerator() + AWSJsonHttpResponseBindingErrorGenerator(), ) override val serdeContext = serdeContextJSON override val shouldRenderEncodableConformance: Boolean = true override val shouldRenderDecodableBodyStructForInputShapes: Boolean = true override val testsToIgnore = setOf( "SDKAppliedContentEncoding_awsJson1_0", - "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_0" + "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_0", ) + override val tagsToIgnore = setOf("defaults") override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String): HttpBindingResolver = AwsJsonHttpBindingResolver(ctx, defaultContentType) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_1_ProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_1_ProtocolGenerator.kt index f46027ef00d..dee34af70e4 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_1_ProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsjson/AwsJson1_1_ProtocolGenerator.kt @@ -32,15 +32,16 @@ class AwsJson1_1_ProtocolGenerator : AWSHttpBindingProtocolGenerator() { override val httpResponseGenerator = HttpResponseGenerator( unknownServiceErrorSymbol, defaultTimestampFormat, - AWSJsonHttpResponseBindingErrorGenerator() + AWSJsonHttpResponseBindingErrorGenerator(), ) override val serdeContext = serdeContextJSON override val shouldRenderEncodableConformance: Boolean = true override val shouldRenderDecodableBodyStructForInputShapes: Boolean = true override val testsToIgnore = setOf( "SDKAppliedContentEncoding_awsJson1_1", - "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1" + "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1", ) + override val tagsToIgnore = setOf("defaults") override fun getProtocolHttpBindingResolver(ctx: ProtocolGenerator.GenerationContext, defaultContentType: String): HttpBindingResolver = AwsJsonHttpBindingResolver(ctx, defaultContentType) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AwsQueryProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AwsQueryProtocolGenerator.kt index 60fc0e06b3b..ba8268c0e7f 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AwsQueryProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/awsquery/AwsQueryProtocolGenerator.kt @@ -44,7 +44,7 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { unknownServiceErrorSymbol, defaultTimestampFormat, AWSRestXMLHttpResponseBindingErrorGenerator(), - AWSXMLHttpResponseBindingErrorInitGeneratorFactory() + AWSXMLHttpResponseBindingErrorInitGeneratorFactory(), ) override val serdeContext = HttpProtocolUnitTestGenerator.SerdeContext("FormURLEncoder()", "XMLDecoder()") @@ -56,8 +56,9 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { override val shouldRenderEncodableConformance = true override val testsToIgnore = setOf( "SDKAppliedContentEncoding_awsQuery", - "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery" + "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery", ) + override val tagsToIgnore = setOf("defaults") override fun renderStructEncode( ctx: ProtocolGenerator.GenerationContext, shapeContainingMembers: Shape, @@ -65,7 +66,7 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { members: List, writer: SwiftWriter, defaultTimestampFormat: TimestampFormatTrait.Format, - path: String? + path: String?, ) { val customizations = AwsQueryFormURLEncodeCustomizations() val encoder = StructEncodeFormURLGenerator(ctx, customizations, shapeContainingMembers, shapeMetadata, members, writer, defaultTimestampFormat) @@ -78,7 +79,7 @@ open class AwsQueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { members: List, writer: SwiftWriter, defaultTimestampFormat: TimestampFormatTrait.Format, - path: String + path: String, ) { val decoder = AwsQueryStructDecodeXMLGenerator(ctx, members, shapeMetadata, writer, defaultTimestampFormat) decoder.render() diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryProtocolGenerator.kt index 92eee9046b2..737accb6d4f 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/ec2query/Ec2QueryProtocolGenerator.kt @@ -40,7 +40,7 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { unknownServiceErrorSymbol, defaultTimestampFormat, AWSEc2QueryHttpResponseBindingErrorGenerator(), - AWSEc2QueryHttpResponseBindingErrorInitGeneratorFactory() + AWSEc2QueryHttpResponseBindingErrorInitGeneratorFactory(), ) override val serdeContext = HttpProtocolUnitTestGenerator.SerdeContext("FormURLEncoder()", "XMLDecoder()") @@ -52,8 +52,9 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { override val shouldRenderEncodableConformance = true override val testsToIgnore = setOf( "SDKAppliedContentEncoding_ec2Query", - "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_ec2Query" + "SDKAppendsGzipAndIgnoresHttpProvidedEncoding_ec2Query", ) + override val tagsToIgnore = setOf("defaults") override fun renderStructEncode( ctx: ProtocolGenerator.GenerationContext, shapeContainingMembers: Shape, @@ -61,7 +62,7 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { members: List, writer: SwiftWriter, defaultTimestampFormat: TimestampFormatTrait.Format, - path: String? + path: String?, ) { val customizations = Ec2QueryFormURLEncodeCustomizations() val encoder = StructEncodeFormURLGenerator(ctx, customizations, shapeContainingMembers, shapeMetadata, members, writer, defaultTimestampFormat) @@ -74,7 +75,7 @@ class Ec2QueryProtocolGenerator : AWSHttpBindingProtocolGenerator() { members: List, writer: SwiftWriter, defaultTimestampFormat: TimestampFormatTrait.Format, - path: String + path: String, ) { val decoder = StructDecodeXMLGenerator(ctx, members, mapOf(), writer, defaultTimestampFormat) decoder.render() diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1ProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1ProtocolGenerator.kt index 2ae4d1c161c..5174e33eacb 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1ProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restjson/AWSRestJson1ProtocolGenerator.kt @@ -25,14 +25,15 @@ class AWSRestJson1ProtocolGenerator : AWSHttpBindingProtocolGenerator() { override val httpResponseGenerator = HttpResponseGenerator( unknownServiceErrorSymbol, defaultTimestampFormat, - AWSRestJson1HttpResponseBindingErrorGeneratable() + AWSRestJson1HttpResponseBindingErrorGeneratable(), ) override val serdeContext = serdeContextJSON override val testsToIgnore = setOf( "SDKAppliedContentEncoding_restJson1", "SDKAppendedGzipAfterProvidedEncoding_restJson1", - "RestJsonHttpPayloadWithUnsetUnion" + "RestJsonHttpPayloadWithUnsetUnion", ) + override val tagsToIgnore = setOf("defaults") override fun generateMessageMarshallable(ctx: ProtocolGenerator.GenerationContext) { var streamingShapes = outputStreamingShapes(ctx) diff --git a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXmlProtocolGenerator.kt b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXmlProtocolGenerator.kt index 63099cece3b..7e18cdf76e7 100644 --- a/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXmlProtocolGenerator.kt +++ b/codegen/smithy-aws-swift-codegen/src/main/kotlin/software/amazon/smithy/aws/swift/codegen/restxml/RestXmlProtocolGenerator.kt @@ -31,7 +31,7 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() { unknownServiceErrorSymbol, defaultTimestampFormat, AWSRestXMLHttpResponseBindingErrorGenerator(), - AWSXMLHttpResponseBindingErrorInitGeneratorFactory() + AWSXMLHttpResponseBindingErrorInitGeneratorFactory(), ) override val shouldRenderDecodableBodyStructForInputShapes = false override val serdeContext = serdeContextXML @@ -47,8 +47,9 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() { "S3EscapePathObjectKeyInUriLabel", "SDKAppliedContentEncoding_restXml", "SDKAppendedGzipAfterProvidedEncoding_restXml", - "S3OperationNoErrorWrappingResponse" + "S3OperationNoErrorWrappingResponse", ) + override val tagsToIgnore = setOf("defaults") override val codableProtocol = SwiftTypes.Protocols.Decodable override val encodableProtocol = null @@ -61,7 +62,7 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() { members: List, writer: SwiftWriter, defaultTimestampFormat: TimestampFormatTrait.Format, - path: String? + path: String?, ) { val encoder = StructEncodeXMLGenerator(ctx, shapeContainingMembers, members, writer) encoder.render() @@ -73,7 +74,7 @@ class RestXmlProtocolGenerator : AWSHttpBindingProtocolGenerator() { members: List, writer: SwiftWriter, defaultTimestampFormat: TimestampFormatTrait.Format, - path: String + path: String, ) { val decoder = RestXmlStructDecodeXMLGenerator(ctx, members, shapeMetadata, writer, defaultTimestampFormat) decoder.render()