Skip to content

Commit 48250f4

Browse files
authored
Update string shape from synthetic to base (#549)
1 parent e6338ca commit 48250f4

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/util/ShapeUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
public final class ShapeUtil {
2929
public static final StringShape STRING_SHAPE = StringShape.builder()
30-
.id("smithy.go.synthetic#String")
30+
.id("smithy.api#String")
3131
.build();
3232

3333
public static final IntegerShape INT_SHAPE = IntegerShape.builder()

codegen/smithy-go-codegen/src/test/java/software/amazon/smithy/go/codegen/GoJmespathExpressionGeneratorTest.java

+29
Original file line numberDiff line numberDiff line change
@@ -492,4 +492,33 @@ public void testMultiSelect() {
492492
v3 := []*string{v1,v2}
493493
"""));
494494
}
495+
496+
@Test
497+
public void testMultiSelectFlatten() {
498+
var expr = "objectList[*].[key][]";
499+
500+
var writer = testWriter();
501+
var generator = new GoJmespathExpressionGenerator(testContext(), writer);
502+
var actual = generator.generate(JmespathExpression.parse(expr), new GoJmespathExpressionGenerator.Variable(
503+
TEST_MODEL.expectShape(ShapeId.from("smithy.go.test#Struct")),
504+
"input"
505+
));
506+
assertThat(actual.shape().toShapeId().toString(), Matchers.equalTo("smithy.go.synthetic#StringList"));
507+
assertThat(actual.ident(), Matchers.equalTo("v5"));
508+
assertThat(writer.toString(), Matchers.containsString("""
509+
v1 := input.ObjectList
510+
var v2 [][]string
511+
for _, v := range v1 {
512+
v3 := v.Key
513+
v4 := []*string{v3}
514+
if v4 != nil {
515+
v2 = append(v2, *v4)
516+
}
517+
}
518+
var v5 []string
519+
for _, v := range v2 {
520+
v5 = append(v5, v...)
521+
}
522+
"""));
523+
}
495524
}

0 commit comments

Comments
 (0)