@@ -201,7 +201,6 @@ public void generateSharedComponents(GenerationContext context) {
201
201
generateDocumentBodyShapeDeserializers (context , deserializingDocumentShapes );
202
202
HttpProtocolGeneratorUtils .generateMetadataDeserializer (context , getApplicationProtocol ().getResponseType ());
203
203
HttpProtocolGeneratorUtils .generateCollectBodyString (context );
204
- HttpProtocolGeneratorUtils .generateHttpBindingUtils (context );
205
204
206
205
writer .write (
207
206
context .getStringStore ().flushVariableDeclarationCode ()
@@ -965,6 +964,7 @@ private void writeRequestHeaders(
965
964
opening = "const headers: any = {" ;
966
965
closing = "};" ;
967
966
} else {
967
+ writer .addImport ("isSerializableHeaderValue" , null , TypeScriptDependency .AWS_SMITHY_CLIENT );
968
968
opening = normalHeaderCount > 0
969
969
? "const headers: any = map({}, isSerializableHeaderValue, {"
970
970
: "const headers: any = map({" ;
@@ -1035,6 +1035,8 @@ private void writeNormalHeader(GenerationContext context, HttpBinding binding) {
1035
1035
: headerValue + defaultValue ;
1036
1036
1037
1037
// evaluated value has a function or method call attached
1038
+ context .getWriter ()
1039
+ .addImport ("isSerializableHeaderValue" , null , TypeScriptDependency .AWS_SMITHY_CLIENT );
1038
1040
headerBuffer .put (headerKey , String .format (
1039
1041
"[%s]: [() => isSerializableHeaderValue(%s), () => %s]," ,
1040
1042
context .getStringStore ().var (headerKey ),
@@ -1093,6 +1095,7 @@ private void writeResponseHeaders(
1093
1095
TypeScriptWriter writer = context .getWriter ();
1094
1096
1095
1097
// Headers are always present either from the default document or the payload.
1098
+ writer .addImport ("isSerializableHeaderValue" , null , TypeScriptDependency .AWS_SMITHY_CLIENT );
1096
1099
writer .openBlock ("let headers: any = map({}, isSerializableHeaderValue, {" , "});" , () -> {
1097
1100
writeContentTypeHeader (context , operationOrError , false );
1098
1101
injectExtraHeaders .run ();
@@ -1373,7 +1376,13 @@ private String getCollectionInputParam(
1373
1376
dataSource = "Array.from(" + dataSource + ".values())" ;
1374
1377
}
1375
1378
String collectionTargetValue = getInputValue (context , bindingType , "_entry" , targetMember , collectionTarget );
1376
- String iteratedParam = "(" + dataSource + " || []).map(_entry => " + collectionTargetValue + " as any)" ;
1379
+ String iteratedParam ;
1380
+ if (collectionTargetValue .equals ("_entry" )) {
1381
+ iteratedParam = "(" + dataSource + " || [])" ;
1382
+ } else {
1383
+ iteratedParam = "(" + dataSource + " || []).map(_entry => " + collectionTargetValue + " as any)" ;
1384
+ }
1385
+
1377
1386
switch (bindingType ) {
1378
1387
case HEADER :
1379
1388
return iteratedParam + ".join(', ')" ;
@@ -2689,20 +2698,25 @@ private String getCollectionOutputParam(
2689
2698
switch (bindingType ) {
2690
2699
case QUERY_PARAMS :
2691
2700
case QUERY :
2701
+ if (collectionTargetValue .equals ("_entry" )) {
2702
+ return String .format ("%1$s" , dataSource );
2703
+ }
2692
2704
return String .format ("%1$s.map(_entry => %2$s as any)" , dataSource , collectionTargetValue );
2693
2705
case LABEL :
2694
2706
dataSource = "(" + dataSource + " || \" \" )" ;
2695
2707
// Split these values on slashes.
2696
2708
outputParam = "" + dataSource + ".split('/')" ;
2697
2709
2698
2710
// Iterate over each entry and do deser work.
2699
- outputParam += ".map(_entry => " + collectionTargetValue + " as any)" ;
2711
+ if (!collectionTargetValue .equals ("_entry" )) {
2712
+ outputParam += ".map(_entry => " + collectionTargetValue + " as any)" ;
2713
+ }
2700
2714
2701
2715
return outputParam ;
2702
2716
case HEADER :
2703
2717
dataSource = "(" + dataSource + " || \" \" )" ;
2704
2718
// Split these values on commas.
2705
- outputParam = "" + dataSource + ".split(',')" ;
2719
+ outputParam = dataSource + ".split(',')" ;
2706
2720
2707
2721
// Headers that have HTTP_DATE formatted timestamps already contain a ","
2708
2722
// in their formatted entry, so split on every other "," instead.
@@ -2719,7 +2733,9 @@ private String getCollectionOutputParam(
2719
2733
}
2720
2734
2721
2735
// Iterate over each entry and do deser work.
2722
- outputParam += ".map(_entry => " + collectionTargetValue + " as any)" ;
2736
+ if (!collectionTargetValue .equals ("_entry" )) {
2737
+ outputParam += ".map(_entry => " + collectionTargetValue + " as any)" ;
2738
+ }
2723
2739
2724
2740
return outputParam ;
2725
2741
default :
0 commit comments