Skip to content

Commit c23cbc4

Browse files
feat(codegen): enable SSDK validation protocol tests (#2884)
As a separate set of models from malformed request tests, Smithy publishes malformed request tests for built-in validation, which exercises how the SSDK rejects requests that do not obey the modeled constraints (such as length, pattern, etc).
1 parent 820e7a2 commit c23cbc4

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

codegen/protocol-test-codegen/smithy-build.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@
126126
}
127127
}
128128
},
129+
"aws-restjson-validation": {
130+
"transforms": [
131+
{
132+
"name": "includeServices",
133+
"args": {
134+
"services": ["aws.protocoltests.restjson.validation#RestJsonValidation"]
135+
}
136+
}
137+
],
138+
"plugins": {
139+
"typescript-ssdk-codegen": {
140+
"package": "@aws-sdk/aws-restjson-validation-server",
141+
"packageVersion": "1.0.0-alpha.1"
142+
}
143+
}
144+
},
129145
"aws-restxml": {
130146
"transforms": [
131147
{

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,16 @@ private static boolean filterMalformedRequestTests(
327327
return true;
328328
}
329329

330+
//TODO: reenable when the SSDK uses RE2 and not built-in regex for pattern constraints
331+
if (testCase.getId().equals("RestJsonMalformedPatternReDOSString")) {
332+
return true;
333+
}
334+
//TODO: broken in Smithy 1.12.0, remove after next Smithy release
335+
if (testCase.getId().equals("RestJsonMalformedLengthBlobOverride_case1")
336+
|| testCase.getId().equals("RestJsonMalformedRequiredQueryNoValue")) {
337+
return true;
338+
}
339+
330340
return false;
331341
}
332342
}

0 commit comments

Comments
 (0)