diff --git a/codegen/protocol-test-codegen/build.gradle.kts b/codegen/protocol-test-codegen/build.gradle.kts index 4a9920380ccc..88e63b917040 100644 --- a/codegen/protocol-test-codegen/build.gradle.kts +++ b/codegen/protocol-test-codegen/build.gradle.kts @@ -16,7 +16,7 @@ import software.amazon.smithy.gradle.tasks.SmithyBuild plugins { - id("software.amazon.smithy") version "0.5.2" + id("software.amazon.smithy") version "0.5.3" } dependencies { diff --git a/codegen/sdk-codegen/build.gradle.kts b/codegen/sdk-codegen/build.gradle.kts index 503cd35c9a6a..55004b2bb784 100644 --- a/codegen/sdk-codegen/build.gradle.kts +++ b/codegen/sdk-codegen/build.gradle.kts @@ -17,7 +17,7 @@ import software.amazon.smithy.model.node.Node import software.amazon.smithy.gradle.tasks.SmithyBuild plugins { - id("software.amazon.smithy") version "0.5.2" + id("software.amazon.smithy") version "0.5.3" } dependencies { diff --git a/codegen/smithy-aws-typescript-codegen/build.gradle.kts b/codegen/smithy-aws-typescript-codegen/build.gradle.kts index 757b84f800c6..1c28f99e29fb 100644 --- a/codegen/smithy-aws-typescript-codegen/build.gradle.kts +++ b/codegen/smithy-aws-typescript-codegen/build.gradle.kts @@ -22,5 +22,6 @@ dependencies { api("software.amazon.smithy:smithy-aws-traits:[1.8.0, 1.9.0[") api("software.amazon.smithy:smithy-waiters:[1.8.0, 1.9.0[") api("software.amazon.smithy:smithy-aws-iam-traits:[1.8.0, 1.9.0[") + api("software.amazon.smithy:smithy-protocol-test-traits:[1.8.0, 1.9.0[") api("software.amazon.smithy.typescript:smithy-typescript-codegen:0.3.0") } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEc2.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEc2.java index 4029a6fcc7d9..062c13fc7c7a 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEc2.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsEc2.java @@ -167,4 +167,9 @@ protected void deserializeOutputDocument( writer.write("contents = $L;", outputStructure.accept(new XmlMemberDeserVisitor(context, "data", Format.DATE_TIME))); } + + @Override + public void generateProtocolTests(GenerationContext context) { + AwsProtocolUtils.generateProtocolTests(this, context); + } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java index f2a1a87d3173..1828617c7b3b 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java @@ -33,8 +33,12 @@ import software.amazon.smithy.model.traits.TimestampFormatTrait; import software.amazon.smithy.model.traits.TimestampFormatTrait.Format; import software.amazon.smithy.model.traits.XmlNamespaceTrait; +import software.amazon.smithy.protocoltests.traits.HttpMessageTestCase; +import software.amazon.smithy.typescript.codegen.HttpProtocolTestGenerator; +import software.amazon.smithy.typescript.codegen.TypeScriptSettings; import software.amazon.smithy.typescript.codegen.TypeScriptWriter; import software.amazon.smithy.typescript.codegen.integration.HttpProtocolGeneratorUtils; +import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator; import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator.GenerationContext; import software.amazon.smithy.utils.SmithyInternalApi; @@ -274,4 +278,21 @@ static String getInputTimestampValueProvider( TimestampFormatTrait.Format format = httpIndex.determineTimestampFormat(memberShape, DOCUMENT, defaultFormat); return HttpProtocolGeneratorUtils.getTimestampInputParam(context, inputLocation, memberShape, format); } + + static void generateProtocolTests(ProtocolGenerator generator, GenerationContext context) { + new HttpProtocolTestGenerator(context, generator, AwsProtocolUtils::filterProtocolTests).run(); + } + + private static boolean filterProtocolTests( + ServiceShape service, + OperationShape operation, + HttpMessageTestCase testCase, + TypeScriptSettings settings + ) { + // TODO: Consume AWSQueryError trait as a follow-up. + if (testCase.getId().equals("QueryCustomizedError")) { + return true; + } + return false; + } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsQuery.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsQuery.java index 8d903d83ac31..055375d5b759 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsQuery.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsQuery.java @@ -168,4 +168,9 @@ protected void deserializeOutputDocument( writer.write("contents = $L;", outputStructure.accept(new XmlMemberDeserVisitor(context, dataSource, Format.DATE_TIME))); } + + @Override + public void generateProtocolTests(GenerationContext context) { + AwsProtocolUtils.generateProtocolTests(this, context); + } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsRestXml.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsRestXml.java index 1b7ed5a3c72c..b92a144819f6 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsRestXml.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsRestXml.java @@ -350,4 +350,9 @@ private void deserializeDocumentBody( }); } } + + @Override + public void generateProtocolTests(GenerationContext context) { + AwsProtocolUtils.generateProtocolTests(this, context); + } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java index 6a776cf4ee51..354726930508 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java @@ -141,4 +141,9 @@ protected void deserializeOutputDocument( private DocumentMemberDeserVisitor getMemberDeserVisitor(GenerationContext context, String dataSource) { return new JsonMemberDeserVisitor(context, dataSource, getDocumentTimestampFormat()); } + + @Override + public void generateProtocolTests(GenerationContext context) { + AwsProtocolUtils.generateProtocolTests(this, context); + } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java index 003a3d1027a0..0feadd7186cb 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java @@ -341,4 +341,9 @@ protected void readPayload( private DocumentMemberDeserVisitor getMemberDeserVisitor(GenerationContext context, String dataSource) { return new JsonMemberDeserVisitor(context, dataSource, getDocumentTimestampFormat()); } + + @Override + public void generateProtocolTests(GenerationContext context) { + AwsProtocolUtils.generateProtocolTests(this, context); + } } diff --git a/protocol_tests/aws-query/tests/functional/awsquery.spec.ts b/protocol_tests/aws-query/tests/functional/awsquery.spec.ts index a26a08b5737a..dcfa51774fa1 100644 --- a/protocol_tests/aws-query/tests/functional/awsquery.spec.ts +++ b/protocol_tests/aws-query/tests/functional/awsquery.spec.ts @@ -548,8 +548,6 @@ it("QueryInvalidGreetingError:Error:GreetingWithErrors", async () => { /** * Parses customized XML errors */ -// Manually skipping to unblock smithy-1.8.x update. -// TODO: Consume AWSQueryError trait as a follow-up. it.skip("QueryCustomizedError:Error:GreetingWithErrors", async () => { const client = new QueryProtocolClient({ ...clientParams,