Skip to content

Commit ca724d4

Browse files
committed
text blocks
1 parent fb4eabb commit ca724d4

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CodegenUtils.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,16 @@ static void writeClientCommandBlobPayloadInputType(
206206
writer.addImport("BlobTypes", null, TypeScriptDependency.AWS_SDK_TYPES);
207207

208208
writer.writeDocs("@public");
209-
writer.openBlock("export type $LType = Omit<$T, $S> & {", "};",
209+
writer.write(
210+
"""
211+
export type $LType = Omit<$T, $S> & {
212+
$L: BlobTypes;
213+
};
214+
""",
210215
typeName,
211216
containerSymbol,
212217
memberName,
213-
() -> {
214-
writer.write("$1L$2L: BlobTypes;", memberName, optionalSuffix);
215-
}
218+
memberName + optionalSuffix
216219
);
217220

218221
writer.writeDocs("@public\n\nThe input for {@link " + commandName + "}.");
@@ -233,13 +236,16 @@ static void writeClientCommandBlobPayloadOutputType(
233236
writer.addDependency(TypeScriptDependency.UTIL_STREAM);
234237

235238
writer.writeDocs("@public");
236-
writer.openBlock("export type $LType = Omit<$T, $S> & {", "};",
239+
writer.write(
240+
"""
241+
export type $LType = Omit<$T, $S> & {
242+
$L: Uint8ArrayBlobAdapter;
243+
};
244+
""",
237245
typeName,
238246
containerSymbol,
239247
memberName,
240-
() -> {
241-
writer.write("$1L$2L: Uint8ArrayBlobAdapter;", memberName, optionalSuffix);
242-
}
248+
memberName + optionalSuffix
243249
);
244250

245251
writer.writeDocs("@public\n\nThe output of {@link " + commandName + "}.");

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/TypeScriptDependency.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public enum TypeScriptDependency implements SymbolDependencyContainer {
5151
MIDDLEWARE_SERDE("dependencies", "@aws-sdk/middleware-serde", true),
5252
MIDDLEWARE_RETRY("dependencies", "@aws-sdk/middleware-retry", true),
5353
UTIL_RETRY("dependencies", "@aws-sdk/util-retry", false),
54-
UTIL_STREAM("dependencies", "@aws-sdk/util-stream", false),
5554
MIDDLEWARE_STACK("dependencies", "@aws-sdk/middleware-stack", true),
5655
MIDDLEWARE_ENDPOINTS_V2("dependencies", "@aws-sdk/middleware-endpoint", false),
5756
AWS_SDK_UTIL_ENDPOINTS("dependencies", "@aws-sdk/util-endpoints", false),

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ public void generateSharedComponents(GenerationContext context) {
200200
generateDocumentBodyShapeSerializers(context, serializingDocumentShapes);
201201
generateDocumentBodyShapeDeserializers(context, deserializingDocumentShapes);
202202
HttpProtocolGeneratorUtils.generateMetadataDeserializer(context, getApplicationProtocol().getResponseType());
203-
HttpProtocolGeneratorUtils.generateCollectBody(context);
204203
HttpProtocolGeneratorUtils.generateCollectBodyString(context);
205204
HttpProtocolGeneratorUtils.generateHttpBindingUtils(context);
206205
}

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -247,26 +247,15 @@ static void generateMetadataDeserializer(GenerationContext context, SymbolRefere
247247
writer.write("");
248248
}
249249

250-
/**
251-
* Imports a response body stream collector. This function converts the low-level response body stream to
252-
* Uint8Array binary data.
253-
*
254-
* @param context The generation context.
255-
*/
256-
static void generateCollectBody(GenerationContext context) {
257-
TypeScriptWriter writer = context.getWriter();
258-
writer.addImport("collectBody", null, TypeScriptDependency.AWS_SMITHY_CLIENT);
259-
}
260-
261250
/**
262251
* Writes a function converting the low-level response body stream to utf-8 encoded string. It depends on
263-
* response body stream collector {@link #generateCollectBody(GenerationContext)}.
252+
* response body stream collector.
264253
*
265254
* @param context The generation context
266255
*/
267256
static void generateCollectBodyString(GenerationContext context) {
268257
TypeScriptWriter writer = context.getWriter();
269-
258+
writer.addImport("collectBody", null, TypeScriptDependency.AWS_SMITHY_CLIENT);
270259
writer.addImport("SerdeContext", "__SerdeContext", TypeScriptDependency.SMITHY_TYPES);
271260
writer.write("// Encode Uint8Array data into string with utf-8.");
272261
writer.write("const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> => "

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpRpcProtocolGenerator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public void generateSharedComponents(GenerationContext context) {
128128
generateDocumentBodyShapeSerializers(context, serializingDocumentShapes);
129129
generateDocumentBodyShapeDeserializers(context, deserializingDocumentShapes);
130130
HttpProtocolGeneratorUtils.generateMetadataDeserializer(context, getApplicationProtocol().getResponseType());
131-
HttpProtocolGeneratorUtils.generateCollectBody(context);
132131
HttpProtocolGeneratorUtils.generateCollectBodyString(context);
133132

134133
TypeScriptWriter writer = context.getWriter();

0 commit comments

Comments
 (0)