Skip to content

Commit b5be82e

Browse files
committed
Add test for MultiSelect List in OperationContextParams
1 parent d293496 commit b5be82e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-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
@@ -44,6 +44,7 @@ public void writesOperationContextParamValues() {
4444
"opContextParamWildcardExpressionList: { type: \"operationContextParams\", get: (input?: any) => input?.fooList }",
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) }",
47+
"opContextParamMultiSelectList: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.baz?.bar, obj?.qux].filter((i) => i)) }",
4748
"opContextParamKeys: { type: \"operationContextParams\", get: (input?: any) => Object.keys(input?.fooKeys ?? {}) }",
4849
}
4950
);

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ namespace smithy.example
2020
opContextParamWildcardExpressionHash: {
2121
type: "stringArray",
2222
},
23+
opContextParamMultiSelectList: {
24+
type: "stringArray",
25+
},
2326
opContextParamKeys: {
2427
type: "stringArray",
2528
},
@@ -37,6 +40,7 @@ service Example {
3740
"opContextParamWildcardExpressionList": { path: "fooList[*]" }
3841
"opContextParamWildcardExpressionListObj": { path: "fooListObj[*].key" }
3942
"opContextParamWildcardExpressionHash": { path: "fooObjObj.*.bar" }
43+
"opContextParamMultiSelectList": { path: "fooListObjObj[*].[baz.bar, qux]" }
4044
"opContextParamKeys": { path: "keys(fooKeys)" }
4145
)
4246
operation GetFoo {
@@ -49,6 +53,7 @@ structure GetFooInput {
4953
fooKeys: FooObject,
5054
fooList: FooList,
5155
fooListObj: FooListObject,
56+
fooListObjObj: FooListObjectObject,
5257
fooObj: FooObject,
5358
fooObjObj: FooObjectObject,
5459
fooString: String,
@@ -58,6 +63,15 @@ structure FooObject {
5863
bar: String
5964
}
6065

66+
list FooListObjectObject {
67+
member: FooMultiSelectObjectObject
68+
}
69+
70+
structure FooMultiSelectObjectObject {
71+
baz: FooObject
72+
qux: String
73+
}
74+
6175
structure FooObjectObject {
6276
baz: FooObject
6377
}

0 commit comments

Comments
 (0)