Skip to content

Commit f017a84

Browse files
authored
chore: update protocol tests (#3913)
1 parent 3b21fb4 commit f017a84

File tree

8 files changed

+939
-3
lines changed

8 files changed

+939
-3
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": "Update protocol tests"
5+
}

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

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,5 +1620,148 @@
16201620
}
16211621
}
16221622
]
1623+
},
1624+
{
1625+
"description": "Union trait",
1626+
"metadata": {
1627+
"protocol": "rest-json",
1628+
"apiVersion": "2014-01-01"
1629+
},
1630+
"shapes": {
1631+
"InputShape": {
1632+
"type": "structure",
1633+
"members": {
1634+
"OneOf": {"shape": "MyUnion"}
1635+
}
1636+
},
1637+
"MyUnion": {
1638+
"type": "structure",
1639+
"union": true,
1640+
"members": {
1641+
"a": {"shape": "StringType"},
1642+
"b": {"shape": "StringType"},
1643+
"c": {"shape": "Struct"},
1644+
"d": {"shape": "Struct"},
1645+
"e": {"shape": "ComplexList"}
1646+
}
1647+
},
1648+
"StringType": {
1649+
"type": "string"
1650+
},
1651+
"Struct": {
1652+
"type": "structure",
1653+
"members": {
1654+
"hello": {"shape": "StringType"}
1655+
}
1656+
},
1657+
"ComplexList": {
1658+
"type": "list",
1659+
"member": {"shape": "Struct"}
1660+
}
1661+
},
1662+
"cases": [
1663+
{
1664+
"given": {
1665+
"input": {
1666+
"shape": "InputShape"
1667+
},
1668+
"http": {
1669+
"method": "POST"
1670+
},
1671+
"name": "OperationName"
1672+
},
1673+
"params": {
1674+
"OneOf": {"a": "hi"}
1675+
},
1676+
"serialized": {
1677+
"uri": "/",
1678+
"body": "{\"OneOf\": {\"a\": \"hi\"}}"
1679+
}
1680+
},
1681+
{
1682+
"given": {
1683+
"input": {
1684+
"shape": "InputShape"
1685+
},
1686+
"http": {
1687+
"method": "POST"
1688+
},
1689+
"name": "OperationName"
1690+
},
1691+
"params": {
1692+
"OneOf": {"b": "hi"}
1693+
},
1694+
"serialized": {
1695+
"uri": "/",
1696+
"body": "{\"OneOf\": {\"b\": \"hi\"}}"
1697+
}
1698+
},
1699+
{
1700+
"given": {
1701+
"input": {
1702+
"shape": "InputShape"
1703+
},
1704+
"http": {
1705+
"method": "POST"
1706+
},
1707+
"name": "OperationName"
1708+
},
1709+
"params": {
1710+
"OneOf": {
1711+
"c": {
1712+
"hello": "hi"
1713+
}
1714+
}
1715+
},
1716+
"serialized": {
1717+
"uri": "/",
1718+
"body": "{\"OneOf\": {\"c\": {\"hello\": \"hi\"}}}"
1719+
}
1720+
},
1721+
{
1722+
"given": {
1723+
"input": {
1724+
"shape": "InputShape"
1725+
},
1726+
"http": {
1727+
"method": "POST"
1728+
},
1729+
"name": "OperationName"
1730+
},
1731+
"params": {
1732+
"OneOf": {
1733+
"d": {
1734+
"hello": "hi"
1735+
}
1736+
}
1737+
},
1738+
"serialized": {
1739+
"uri": "/",
1740+
"body": "{\"OneOf\": {\"d\": {\"hello\": \"hi\"}}}"
1741+
}
1742+
},
1743+
{
1744+
"given": {
1745+
"input": {
1746+
"shape": "InputShape"
1747+
},
1748+
"http": {
1749+
"method": "POST"
1750+
},
1751+
"name": "OperationName"
1752+
},
1753+
"params": {
1754+
"OneOf": {
1755+
"e": [
1756+
{"hello": "hi"}
1757+
]
1758+
}
1759+
},
1760+
"serialized": {
1761+
"uri": "/",
1762+
"body": "{\"OneOf\": {\"e\": [{\"hello\": \"hi\"}]}}"
1763+
}
1764+
}
1765+
]
16231766
}
16241767
]

test/fixtures/protocol/output/ec2.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,5 +567,92 @@
567567
}
568568
}
569569
]
570+
},
571+
{
572+
"description": "Modeled exceptions",
573+
"metadata": {
574+
"protocol": "ec2"
575+
},
576+
"shapes": {
577+
"ExceptionShape": {
578+
"type": "structure",
579+
"members": {
580+
"Status": {
581+
"shape": "StatusShape",
582+
"location": "statusCode"
583+
},
584+
"BodyMember": {
585+
"shape": "StringType"
586+
},
587+
"Message": {
588+
"shape": "StringType"
589+
}
590+
}
591+
},
592+
"OtherExceptionShape": {
593+
"BodyMember": {
594+
"shape": "StringType"
595+
}
596+
},
597+
"StatusShape": {
598+
"type": "integer"
599+
},
600+
"StringType": {
601+
"type": "string"
602+
}
603+
},
604+
"cases": [
605+
{
606+
"given": {
607+
"errors": [
608+
{"shape": "ExceptionShape"}
609+
],
610+
"name": "OperationName"
611+
},
612+
"error": {
613+
"Status": 400,
614+
"BodyMember": "mybody",
615+
"Message": "mymessage"
616+
},
617+
"errorCode": "ExceptionShape",
618+
"errorMessage": "mymessage",
619+
"response": {
620+
"status_code": 400,
621+
"headers": {},
622+
"body": "<Response><Errors><Error><Code>ExceptionShape</Code><Message>mymessage</Message><BodyMember>mybody</BodyMember></Error></Errors></Response>"
623+
}
624+
},
625+
{
626+
"given": {
627+
"errors": [
628+
{"shape": "ExceptionShape"}
629+
],
630+
"name": "OperationName"
631+
},
632+
"error": {},
633+
"errorCode": "OtherExceptionShape",
634+
"errorMessage": "mymessage",
635+
"response": {
636+
"status_code": 400,
637+
"headers": {},
638+
"body": "<Response><Errors><Error><Code>OtherExceptionShape</Code><Message>mymessage</Message><BodyMember>mybody</BodyMember></Error></Errors></Response>"
639+
}
640+
},
641+
{
642+
"given": {
643+
"errors": [
644+
{"shape": "ExceptionShape"}
645+
],
646+
"name": "OperationName"
647+
},
648+
"error": {},
649+
"errorCode": "UndefinedShape",
650+
"response": {
651+
"status_code": 400,
652+
"headers": {},
653+
"body": "<Response><Errors><Error><Code>UndefinedShape</Code><BodyMember>mybody</BodyMember></Error></Errors></Response>"
654+
}
655+
}
656+
]
570657
}
571658
]

0 commit comments

Comments
 (0)