Skip to content

Commit b4efe8e

Browse files
committed
Add test for MultiSelect List flatten in OperationContextParams
1 parent dbced06 commit b4efe8e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/CommandGeneratorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public void writesOperationContextParamValues() {
4545
"opContextParamWildcardExpressionListObj: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObj?.map((obj: any) => obj?.key) }",
4646
"opContextParamWildcardExpressionHash: { type: \"operationContextParams\", get: (input?: any) => Object.values(input?.fooObjObj ?? {}).map((obj: any) => obj?.bar) }",
4747
"opContextParamMultiSelectList: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.fooList[0],obj?.fooObject?.bar,obj?.fooString].filter((i) => i)) }",
48+
"opContextParamMultiSelectListFlatten: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.fooList].filter((i) => i).flat()) }",
4849
"opContextParamKeys: { type: \"operationContextParams\", get: (input?: any) => Object.keys(input?.fooKeys ?? {}) }",
4950
}
5051
);

smithy-typescript-codegen/src/test/resources/software/amazon/smithy/typescript/codegen/endpointsV2/endpoints-operation-context-params.smithy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ namespace smithy.example
2323
opContextParamMultiSelectList: {
2424
type: "stringArray",
2525
},
26+
opContextParamMultiSelectListFlatten: {
27+
type: "stringArray",
28+
},
2629
opContextParamKeys: {
2730
type: "stringArray",
2831
},
@@ -41,6 +44,7 @@ service Example {
4144
"opContextParamWildcardExpressionListObj": { path: "fooListObj[*].key" }
4245
"opContextParamWildcardExpressionHash": { path: "fooObjObj.*.bar" }
4346
"opContextParamMultiSelectList": { path: "fooListObjObj[*].[fooList[0], fooObject.bar, fooString]" }
47+
"opContextParamMultiSelectListFlatten": { path: "fooListObjObj[*].[fooList][]" }
4448
"opContextParamKeys": { path: "keys(fooKeys)" }
4549
)
4650
operation GetFoo {

0 commit comments

Comments
 (0)