Skip to content

Commit 74e3e02

Browse files
authored
test: add protocol test for union (#4645)
1 parent 2d3f3d1 commit 74e3e02

File tree

3 files changed

+157
-0
lines changed

3 files changed

+157
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "feature",
3+
"category": "protocol",
4+
"description": "test for union"
5+
}

test/fixtures/protocol/output/json.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,82 @@
432432
}
433433
]
434434
},
435+
{
436+
"description": "Union output, ignore __type before",
437+
"metadata": {
438+
"protocol": "json"
439+
},
440+
"shapes": {
441+
"OutputShape": {
442+
"type": "structure",
443+
"members": {
444+
"Str": {
445+
"shape": "StringType"
446+
}
447+
},
448+
"union": true
449+
},
450+
"StringType": {
451+
"type": "string"
452+
}
453+
},
454+
"cases": [
455+
{
456+
"given": {
457+
"output": {
458+
"shape": "OutputShape"
459+
},
460+
"name": "OperationName"
461+
},
462+
"result": {
463+
"Str": "foo"
464+
},
465+
"response": {
466+
"status_code": 200,
467+
"headers": {},
468+
"body": "{\"__type\": \"com.foo#OutputShape\", \"Str\": \"foo\"}"
469+
}
470+
}
471+
]
472+
},
473+
{
474+
"description": "Union output, ignore __type after",
475+
"metadata": {
476+
"protocol": "json"
477+
},
478+
"shapes": {
479+
"OutputShape": {
480+
"type": "structure",
481+
"members": {
482+
"Str": {
483+
"shape": "StringType"
484+
}
485+
},
486+
"union": true
487+
},
488+
"StringType": {
489+
"type": "string"
490+
}
491+
},
492+
"cases": [
493+
{
494+
"given": {
495+
"output": {
496+
"shape": "OutputShape"
497+
},
498+
"name": "OperationName"
499+
},
500+
"result": {
501+
"Str": "foo"
502+
},
503+
"response": {
504+
"status_code": 200,
505+
"headers": {},
506+
"body": "{\"Str\": \"foo\", \"__type\": \"com.foo#OutputShape\"}"
507+
}
508+
}
509+
]
510+
},
435511
{
436512
"description": "Modeled exceptions",
437513
"metadata": {

test/fixtures/protocol/output/rest-json.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,82 @@
844844
}
845845
]
846846
},
847+
{
848+
"description": "Union output, ignore __type before",
849+
"metadata": {
850+
"protocol": "json"
851+
},
852+
"shapes": {
853+
"OutputShape": {
854+
"type": "structure",
855+
"members": {
856+
"Str": {
857+
"shape": "StringType"
858+
}
859+
},
860+
"union": true
861+
},
862+
"StringType": {
863+
"type": "string"
864+
}
865+
},
866+
"cases": [
867+
{
868+
"given": {
869+
"output": {
870+
"shape": "OutputShape"
871+
},
872+
"name": "OperationName"
873+
},
874+
"result": {
875+
"Str": "foo"
876+
},
877+
"response": {
878+
"status_code": 200,
879+
"headers": {},
880+
"body": "{\"__type\": \"com.foo#OutputShape\", \"Str\": \"foo\"}"
881+
}
882+
}
883+
]
884+
},
885+
{
886+
"description": "Union output, ignore __type after",
887+
"metadata": {
888+
"protocol": "json"
889+
},
890+
"shapes": {
891+
"OutputShape": {
892+
"type": "structure",
893+
"members": {
894+
"Str": {
895+
"shape": "StringType"
896+
}
897+
},
898+
"union": true
899+
},
900+
"StringType": {
901+
"type": "string"
902+
}
903+
},
904+
"cases": [
905+
{
906+
"given": {
907+
"output": {
908+
"shape": "OutputShape"
909+
},
910+
"name": "OperationName"
911+
},
912+
"result": {
913+
"Str": "foo"
914+
},
915+
"response": {
916+
"status_code": 200,
917+
"headers": {},
918+
"body": "{\"Str\": \"foo\", \"__type\": \"com.foo#OutputShape\"}"
919+
}
920+
}
921+
]
922+
},
847923
{
848924
"description": "Modeled exceptions",
849925
"metadata": {

0 commit comments

Comments
 (0)