Skip to content

Commit b969772

Browse files
committed
Add tests for Operation Context Params List Wildcard Expressions
1 parent 1e7e865 commit b969772

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public void writesOperationContextParamValues() {
4141
new String[] {
4242
"opContextParamIdentifier: { type: \"operationContextParams\", name: this.input.fooString }",
4343
"opContextParamSubExpression: { type: \"operationContextParams\", name: this.input.fooObj.bar }",
44+
"opContextParamWildcardExpressionList: { type: \"operationContextParams\", name: this.input.fooList.map(obj => obj) }",
45+
"opContextParamWildcardExpressionListObj: { type: \"operationContextParams\", name: this.input.fooListObj.map(obj => obj.key) }",
4446
}
4547
);
4648
}

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ namespace smithy.example
1111
opContextParamSubExpression: {
1212
type: "string",
1313
},
14+
opContextParamWildcardExpressionList: {
15+
type: "stringArray",
16+
},
17+
opContextParamWildcardExpressionListObj: {
18+
type: "stringArray",
19+
},
1420
},
1521
rules: []
1622
})
@@ -22,6 +28,8 @@ service Example {
2228
@smithy.rules#operationContextParams(
2329
"opContextParamIdentifier": { path: "fooString" }
2430
"opContextParamSubExpression": { path: "fooObj.bar" }
31+
"opContextParamWildcardExpressionList": { path: "fooList[*]" }
32+
"opContextParamWildcardExpressionListObj": { path: "fooListObj[*].key" }
2533
)
2634
operation GetFoo {
2735
input: GetFooInput,
@@ -31,13 +39,27 @@ operation GetFoo {
3139

3240
structure GetFooInput {
3341
fooString: String,
34-
fooObj: FooObject
42+
fooObj: FooObject,
43+
fooList: FooList,
44+
fooListObj: FooListObj,
3545
}
3646

3747
structure FooObject {
3848
bar: String
3949
}
4050

51+
list FooList {
52+
member: String
53+
}
54+
55+
list FooListObj {
56+
member: FooListObjMember
57+
}
58+
59+
structure FooListObjMember {
60+
key: String
61+
}
62+
4163
structure GetFooOutput {}
4264

4365
@error("client")

0 commit comments

Comments
 (0)