Skip to content

Commit b60266d

Browse files
committed
Test filtersSensitiveMemberPointingToUnion
1 parent ea7a8e2 commit b60266d

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ public void filtersSensitiveUnion() {
190190
+ " })\n");
191191
}
192192

193+
@Test
194+
public void filtersSensitiveMemberPointingToUnion() {
195+
testStructureCodegen("test-sensitive-member-pointing-to-union.smithy",
196+
" export const filterSensitiveLog = (obj: GetFooInput): any => ({\n"
197+
+ " ...obj,\n"
198+
+ " ...(obj.sensitiveFoo && { sensitiveFoo:\n"
199+
+ " SENSITIVE_STRING\n"
200+
+ " }),\n"
201+
+ " })\n");
202+
}
203+
193204
@Test
194205
public void callsFilterForListWithSensitiveData() {
195206
testStructureCodegen("test-list-with-sensitive-data.smithy",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
namespace smithy.example
2+
3+
service Example {
4+
version: "1.0.0",
5+
operations: [GetFoo]
6+
}
7+
8+
operation GetFoo {
9+
input: GetFooInput
10+
}
11+
12+
structure GetFooInput {
13+
@sensitive
14+
sensitiveFoo: TestUnion
15+
}
16+
17+
union TestUnion {
18+
fooString: String,
19+
barString: String
20+
}

0 commit comments

Comments
 (0)