Skip to content

Commit

Permalink
Update string shape from synthetic to base (#549)
Browse files Browse the repository at this point in the history
  • Loading branch information
Madrigal authored Oct 31, 2024
1 parent e6338ca commit 48250f4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public final class ShapeUtil {
public static final StringShape STRING_SHAPE = StringShape.builder()
.id("smithy.go.synthetic#String")
.id("smithy.api#String")
.build();

public static final IntegerShape INT_SHAPE = IntegerShape.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,33 @@ public void testMultiSelect() {
v3 := []*string{v1,v2}
"""));
}

@Test
public void testMultiSelectFlatten() {
var expr = "objectList[*].[key][]";

var writer = testWriter();
var generator = new GoJmespathExpressionGenerator(testContext(), writer);
var actual = generator.generate(JmespathExpression.parse(expr), new GoJmespathExpressionGenerator.Variable(
TEST_MODEL.expectShape(ShapeId.from("smithy.go.test#Struct")),
"input"
));
assertThat(actual.shape().toShapeId().toString(), Matchers.equalTo("smithy.go.synthetic#StringList"));
assertThat(actual.ident(), Matchers.equalTo("v5"));
assertThat(writer.toString(), Matchers.containsString("""
v1 := input.ObjectList
var v2 [][]string
for _, v := range v1 {
v3 := v.Key
v4 := []*string{v3}
if v4 != nil {
v2 = append(v2, *v4)
}
}
var v5 []string
for _, v := range v2 {
v5 = append(v5, v...)
}
"""));
}
}

0 comments on commit 48250f4

Please sign in to comment.