Skip to content

Commit

Permalink
test: add protocol test for union (#4645)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Jun 6, 2024
1 parent 2d3f3d1 commit 74e3e02
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/feature-protocol-2da87ea9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "feature",
"category": "protocol",
"description": "test for union"
}
76 changes: 76 additions & 0 deletions test/fixtures/protocol/output/json.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,82 @@
}
]
},
{
"description": "Union output, ignore __type before",
"metadata": {
"protocol": "json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"Str": {
"shape": "StringType"
}
},
"union": true
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Str": "foo"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"__type\": \"com.foo#OutputShape\", \"Str\": \"foo\"}"
}
}
]
},
{
"description": "Union output, ignore __type after",
"metadata": {
"protocol": "json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"Str": {
"shape": "StringType"
}
},
"union": true
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Str": "foo"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"Str\": \"foo\", \"__type\": \"com.foo#OutputShape\"}"
}
}
]
},
{
"description": "Modeled exceptions",
"metadata": {
Expand Down
76 changes: 76 additions & 0 deletions test/fixtures/protocol/output/rest-json.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,82 @@
}
]
},
{
"description": "Union output, ignore __type before",
"metadata": {
"protocol": "json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"Str": {
"shape": "StringType"
}
},
"union": true
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Str": "foo"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"__type\": \"com.foo#OutputShape\", \"Str\": \"foo\"}"
}
}
]
},
{
"description": "Union output, ignore __type after",
"metadata": {
"protocol": "json"
},
"shapes": {
"OutputShape": {
"type": "structure",
"members": {
"Str": {
"shape": "StringType"
}
},
"union": true
},
"StringType": {
"type": "string"
}
},
"cases": [
{
"given": {
"output": {
"shape": "OutputShape"
},
"name": "OperationName"
},
"result": {
"Str": "foo"
},
"response": {
"status_code": 200,
"headers": {},
"body": "{\"Str\": \"foo\", \"__type\": \"com.foo#OutputShape\"}"
}
}
]
},
{
"description": "Modeled exceptions",
"metadata": {
Expand Down

0 comments on commit 74e3e02

Please sign in to comment.