Skip to content

Commit 92b6cbb

Browse files
committed
uniform usage of LazyJsonString
1 parent a39f139 commit 92b6cbb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public static String getStringInputParam(GenerationContext context, Shape shape,
176176
if (CodegenUtils.isJsonMediaType(mediaType)) {
177177
TypeScriptWriter writer = context.getWriter();
178178
writer.addImport("LazyJsonString", "__LazyJsonString", TypeScriptDependency.AWS_SMITHY_CLIENT);
179-
return "__LazyJsonString.fromObject(" + dataSource + ")";
179+
return "__LazyJsonString.from(" + dataSource + ")";
180180
} else {
181181
LOGGER.warning(() -> "Found unsupported mediatype " + mediaType + " on String shape: " + shape);
182182
}
@@ -210,7 +210,7 @@ public static String getStringOutputParam(GenerationContext context,
210210
if (CodegenUtils.isJsonMediaType(mediaType)) {
211211
TypeScriptWriter writer = context.getWriter();
212212
writer.addImport("LazyJsonString", "__LazyJsonString", TypeScriptDependency.AWS_SMITHY_CLIENT);
213-
return "new __LazyJsonString(" + dataSource + ")";
213+
return "__LazyJsonString.from(" + dataSource + ")";
214214
} else {
215215
LOGGER.warning(() -> "Found unsupported mediatype " + mediaType + " on String shape: " + shape);
216216
}

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberDeserVisitorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static Collection<Object[]> validMemberTargetTypes() {
9898
{StringShape.builder().id(id).build(), "__expectString(" + DATA_SOURCE + ")", source},
9999
{
100100
StringShape.builder().id(id).addTrait(new MediaTypeTrait("foo+json")).build(),
101-
"new __LazyJsonString(" + DATA_SOURCE + ")",
101+
"__LazyJsonString.from(" + DATA_SOURCE + ")",
102102
source
103103
},
104104
{BlobShape.builder().id(id).build(), "context.base64Decoder(" + DATA_SOURCE + ")", source},

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/integration/DocumentMemberSerVisitorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static Collection<Object[]> validMemberTargetTypes() {
8383
{StringShape.builder().id(id).build(), DATA_SOURCE},
8484
{
8585
StringShape.builder().id(id).addTrait(new MediaTypeTrait("foo+json")).build(),
86-
"__LazyJsonString.fromObject(" + DATA_SOURCE + ")"
86+
"__LazyJsonString.from(" + DATA_SOURCE + ")"
8787
},
8888
{BlobShape.builder().id(id).build(), "context.base64Encoder(" + DATA_SOURCE + ")"},
8989
{DocumentShape.builder().id(id).build(), delegate},

0 commit comments

Comments
 (0)