@@ -164,293 +164,6 @@ public void generatesRetryableTraitWithThrottling() {
164
164
+ "}\n " );
165
165
}
166
166
167
- @ Test
168
- public void filtersSensitiveSimpleShape () {
169
- testStructureCodegen ("test-sensitive-simple-shape.smithy" ,
170
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
171
- + " ...obj,\n "
172
- + " ...(obj.password && { password:\n "
173
- + " SENSITIVE_STRING\n "
174
- + " }),\n "
175
- + "})\n " );
176
- }
177
-
178
- @ Test
179
- public void skipsFilterForInsensitiveSimpleShape () {
180
- testStructureCodegenExcludes ("test-insensitive-simple-shape.smithy" ,
181
- "GetFooInputFilterSensitiveLog" );
182
- }
183
-
184
- @ Test
185
- public void callsFilterForStructureWithSensitiveData () {
186
- testStructureCodegen ("test-structure-with-sensitive-data.smithy" ,
187
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
188
- + " ...obj,\n "
189
- + " ...(obj.foo && { foo:\n "
190
- + " UserFilterSensitiveLog(obj.foo)\n "
191
- + " }),\n "
192
- + "})" );
193
- }
194
-
195
- @ Test
196
- public void callsFilterInStructureWithSensitiveData () {
197
- testStructureCodegen ("test-structure-with-sensitive-data.smithy" ,
198
- "export const UserFilterSensitiveLog = (obj: User): any => ({\n "
199
- + " ...obj,\n "
200
- + " ...(obj.password && { password:\n "
201
- + " SENSITIVE_STRING\n "
202
- + " }),\n "
203
- + "})" );
204
- }
205
-
206
- @ Test
207
- public void filtersSensitiveStructure () {
208
- testStructureCodegen ("test-sensitive-structure.smithy" ,
209
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
210
- + " ...obj,\n "
211
- + " ...(obj.foo && { foo:\n "
212
- + " SENSITIVE_STRING\n "
213
- + " }),\n "
214
- + "})" );
215
- }
216
-
217
- @ Test
218
- public void skipsFilterForStructureWithoutSensitiveData () {
219
- testStructureCodegenExcludes ("test-structure-without-sensitive-data.smithy" ,
220
- "GetFooInputFilterSensitiveLog" );
221
- }
222
-
223
- @ Test
224
- public void callsFilterForUnionWithSensitiveData () {
225
- testStructureCodegen ("test-union-with-sensitive-data.smithy" ,
226
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
227
- + " ...obj,\n "
228
- + " ...(obj.foo && { foo:\n "
229
- + " TestUnionFilterSensitiveLog(obj.foo)\n "
230
- + " }),\n "
231
- + "})" );
232
- }
233
-
234
- @ Test
235
- public void callsFilterInUnionWithSensitiveData () {
236
- testStructureCodegen ("test-union-with-sensitive-data.smithy" ,
237
- "export const TestUnionFilterSensitiveLog = (obj: TestUnion): any => {\n "
238
- + " if (obj.bar !== undefined) return {bar:\n "
239
- + " obj.bar\n "
240
- + " };\n "
241
- + " if (obj.sensitiveBar !== undefined) return {sensitiveBar:\n "
242
- + " SENSITIVE_STRING\n "
243
- + " };\n "
244
- + " if (obj.$unknown !== undefined) return {[obj.$unknown[0]]: 'UNKNOWN'};\n "
245
- + "}" );
246
- }
247
-
248
- @ Test
249
- public void callsFilterForUnionWithoutSensitiveData () {
250
- testStructureCodegenExcludes ("test-union-without-sensitive-data.smithy" ,
251
- "GetFooInputFilterSensitiveLog" );
252
- }
253
-
254
- @ Test
255
- public void skipsFilterInUnionWithoutSensitiveData () {
256
- testStructureCodegenExcludes ("test-union-without-sensitive-data.smithy" ,
257
- "TestUnionFilterSensitiveLog" );
258
- }
259
-
260
- @ Test
261
- public void filtersStreamingUnion () {
262
- testStructureCodegen ("test-streaming-union.smithy" ,
263
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
264
- + " ...obj,\n "
265
- + " ...(obj.foo && { foo:\n "
266
- + " 'STREAMING_CONTENT'\n "
267
- + " }),\n "
268
- + "})" );
269
- }
270
-
271
- @ Test
272
- public void filtersSensitiveUnion () {
273
- testStructureCodegen ("test-sensitive-union.smithy" ,
274
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
275
- + " ...obj,\n "
276
- + " ...(obj.foo && { foo:\n "
277
- + " SENSITIVE_STRING\n "
278
- + " }),\n "
279
- + "})" );
280
- }
281
-
282
- @ Test
283
- public void callsFilterForListWithStructureWithSensitiveData () {
284
- testStructureCodegen ("test-list-with-structure-with-sensitive-data.smithy" ,
285
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
286
- + " ...obj,\n "
287
- + " ...(obj.foo && { foo:\n "
288
- + " obj.foo.map(\n "
289
- + " item =>\n "
290
- + " UserFilterSensitiveLog(item)\n "
291
- + " )\n "
292
- + " }),\n "
293
- + "})" );
294
- }
295
-
296
- @ Test
297
- public void callsFilterInListWithStructureWithSensitiveData () {
298
- testStructureCodegen ("test-list-with-structure-with-sensitive-data.smithy" ,
299
- "export const UserFilterSensitiveLog = (obj: User): any => ({\n "
300
- + " ...obj,\n "
301
- + " ...(obj.password && { password:\n "
302
- + " SENSITIVE_STRING\n "
303
- + " }),\n "
304
- + "})" );
305
- }
306
-
307
- @ Test
308
- public void callsFilterForListWithUnionWithSensitiveData () {
309
- testStructureCodegen ("test-list-with-union-with-sensitive-data.smithy" ,
310
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
311
- + " ...obj,\n "
312
- + " ...(obj.foo && { foo:\n "
313
- + " obj.foo.map(\n "
314
- + " item =>\n "
315
- + " TestUnionFilterSensitiveLog(item)\n "
316
- + " )\n "
317
- + " }),\n "
318
- + "})" );
319
- }
320
-
321
- @ Test
322
- public void callsFilterInListWithUnionWithSensitiveData () {
323
- testStructureCodegen ("test-list-with-union-with-sensitive-data.smithy" ,
324
- "export const TestUnionFilterSensitiveLog = (obj: TestUnion): any => {\n "
325
- + " if (obj.bar !== undefined) return {bar:\n "
326
- + " obj.bar\n "
327
- + " };\n "
328
- + " if (obj.sensitiveBar !== undefined) return {sensitiveBar:\n "
329
- + " SENSITIVE_STRING\n "
330
- + " };\n "
331
- + " if (obj.$unknown !== undefined) return {[obj.$unknown[0]]: 'UNKNOWN'};\n "
332
- + "}\n " );
333
- }
334
-
335
- @ Test
336
- public void callsFilterForListWithSensitiveMember () {
337
- testStructureCodegen ("test-list-with-sensitive-member.smithy" ,
338
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
339
- + " ...obj,\n "
340
- + " ...(obj.foo && { foo:\n "
341
- + " SENSITIVE_STRING\n "
342
- + " }),\n "
343
- + "})" );
344
- }
345
-
346
- @ Test
347
- public void filtersSensitiveList () {
348
- testStructureCodegen ("test-sensitive-list.smithy" ,
349
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
350
- + " ...obj,\n "
351
- + " ...(obj.foo && { foo:\n "
352
- + " SENSITIVE_STRING\n "
353
- + " }),\n "
354
- + "})" );
355
- }
356
-
357
- @ Test
358
- public void skipsFilterForInsensitiveList () {
359
- testStructureCodegenExcludes ("test-insensitive-list.smithy" ,
360
- "GetFooInputFilterSensitiveLog" );
361
- }
362
-
363
- @ Test
364
- public void callsFilterForMapWithStructureWithSensitiveData () {
365
- testStructureCodegen ("test-map-with-structure-with-sensitive-data.smithy" ,
366
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
367
- + " ...obj,\n "
368
- + " ...(obj.foo && { foo:\n "
369
- + " Object.entries(obj.foo).reduce((acc: any, [key, value]: [string, User]) => (\n "
370
- + " acc[key] =\n "
371
- + " UserFilterSensitiveLog(value)\n "
372
- + " ,\n "
373
- + " acc\n "
374
- + " ), {})\n "
375
- + " }),\n "
376
- + "})" );
377
- }
378
-
379
- @ Test
380
- public void callsFilterInMapWithStructureWithSensitiveData () {
381
- testStructureCodegen ("test-map-with-structure-with-sensitive-data.smithy" ,
382
- "export const UserFilterSensitiveLog = (obj: User): any => ({\n "
383
- + " ...obj,\n "
384
- + " ...(obj.password && { password:\n "
385
- + " SENSITIVE_STRING\n "
386
- + " }),\n "
387
- + "})" );
388
- }
389
-
390
- @ Test
391
- public void callsFilterForMapWithUnionWithSensitiveData () {
392
- testStructureCodegen ("test-map-with-union-with-sensitive-data.smithy" ,
393
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
394
- + " ...obj,\n "
395
- + " ...(obj.foo && { foo:\n "
396
- + " Object.entries(obj.foo).reduce((acc: any, [key, value]: [string, TestUnion]) => (\n "
397
- + " acc[key] =\n "
398
- + " TestUnionFilterSensitiveLog(value)\n "
399
- + " ,\n "
400
- + " acc\n "
401
- + " ), {})\n "
402
- + " }),\n "
403
- + "})" );
404
- }
405
-
406
- @ Test
407
- public void callsFilterInMapWithUnionWithSensitiveData () {
408
- testStructureCodegen ("test-map-with-union-with-sensitive-data.smithy" ,
409
- "export const TestUnionFilterSensitiveLog = (obj: TestUnion): any => {\n "
410
- + " if (obj.bar !== undefined) return {bar:\n "
411
- + " obj.bar\n "
412
- + " };\n "
413
- + " if (obj.sensitiveBar !== undefined) return {sensitiveBar:\n "
414
- + " SENSITIVE_STRING\n "
415
- + " };\n "
416
- + " if (obj.$unknown !== undefined) return {[obj.$unknown[0]]: 'UNKNOWN'};\n "
417
- + "}\n " );
418
- }
419
-
420
- @ Test
421
- public void callsFilterForMapWithSensitiveMember () {
422
- testStructureCodegen ("test-map-with-sensitive-member.smithy" ,
423
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
424
- + " ...obj,\n "
425
- + " ...(obj.foo && { foo:\n "
426
- + " SENSITIVE_STRING\n "
427
- + " }),\n "
428
- + "})" );
429
- }
430
-
431
- @ Test
432
- public void filtersSensitiveMap () {
433
- testStructureCodegen ("test-sensitive-map.smithy" ,
434
- "export const GetFooInputFilterSensitiveLog = (obj: GetFooInput): any => ({\n "
435
- + " ...obj,\n "
436
- + " ...(obj.foo && { foo:\n "
437
- + " SENSITIVE_STRING\n "
438
- + " }),\n "
439
- + "})" );
440
- }
441
-
442
- @ Test
443
- public void skipsFilterForInsensitiveMap () {
444
- testStructureCodegenExcludes ("test-insensitive-map.smithy" ,
445
- "GetFooInputFilterSensitiveLog" );
446
- }
447
-
448
- @ Test
449
- public void skipsFilterOnEncounteringRecursiveShapes () {
450
- testStructureCodegenExcludes ("test-recursive-shapes.smithy" ,
451
- "GetFooInputFilterSensitiveLog" );
452
- }
453
-
454
167
@ Test
455
168
public void properlyGeneratesRequiredMessageMemberNotBackwardCompatible () {
456
169
testStructureCodegenBase ("test-required-member.smithy" ,
0 commit comments