Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update string shape from synthetic to base #549

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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...)
}
"""));
}
}
Loading