Skip to content

Commit d555e5a

Browse files
authored
Fix protocol tests with new changes to CBOR and Rest (#3123)
1 parent b406add commit d555e5a

File tree

16 files changed

+346
-88
lines changed

16 files changed

+346
-88
lines changed

build_tools/aws-sdk-code-generator/spec/protocol-tests-ignore-list.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"rest-xml" : {
3-
"input" : {},
3+
"input" : {
4+
"NestedXmlMapWithXmlNameSerializes": {
5+
"description": "Smithy 1.52.0 did not include a fix to this test.",
6+
"engines": ["ox", "nokogiri", "rexml", "libxml", "oga"]
7+
}
8+
},
49
"output" : {
510
"SimpleScalarPropertiesComplexEscapes": {
611
"description": "OxEngine does not handle all escape cases but other engines supports it",

build_tools/aws-sdk-code-generator/spec/protocol-tests/input/rest-json.json

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@
16851685
},
16861686
"documentation": "<p>This examples adds headers to the input of a request and response by prefix.</p>"
16871687
},
1688-
"description": "No prefix headers are serialized because the value is empty",
1688+
"description": "No prefix headers are serialized because the value is not present",
16891689
"params": {
16901690
"foo": "Foo",
16911691
"fooMap": {}
@@ -1698,6 +1698,35 @@
16981698
"X-Foo": "Foo"
16991699
}
17001700
}
1701+
},
1702+
{
1703+
"id": "RestJsonHttpPrefixEmptyHeaders",
1704+
"given": {
1705+
"name": "HttpPrefixHeaders",
1706+
"http": {
1707+
"method": "GET",
1708+
"requestUri": "/HttpPrefixHeaders",
1709+
"responseCode": 200
1710+
},
1711+
"input": {
1712+
"shape": "HttpPrefixHeadersInput"
1713+
},
1714+
"documentation": "<p>This examples adds headers to the input of a request and response by prefix.</p>"
1715+
},
1716+
"description": "Serialize prefix headers were the value is present but empty",
1717+
"params": {
1718+
"fooMap": {
1719+
"Abc": ""
1720+
}
1721+
},
1722+
"serialized": {
1723+
"method": "GET",
1724+
"uri": "/HttpPrefixHeaders",
1725+
"body": "",
1726+
"headers": {
1727+
"X-Foo-Abc": ""
1728+
}
1729+
}
17011730
}
17021731
]
17031732
},
@@ -4362,7 +4391,7 @@
43624391
},
43634392
"documentation": "<p>Null and empty headers are not sent over the wire.</p>"
43644393
},
4365-
"description": "Do not send null values, empty strings, or empty lists over the wire in headers",
4394+
"description": "Do not send null values, but do send empty strings and empty lists over the wire in headers",
43664395
"params": {
43674396
"a": null,
43684397
"b": "",
@@ -4372,10 +4401,12 @@
43724401
"method": "GET",
43734402
"uri": "/NullAndEmptyHeadersClient",
43744403
"body": "",
4404+
"headers": {
4405+
"X-B": "",
4406+
"X-C": ""
4407+
},
43754408
"forbidHeaders": [
4376-
"X-A",
4377-
"X-B",
4378-
"X-C"
4409+
"X-A"
43794410
]
43804411
}
43814412
}

build_tools/aws-sdk-code-generator/spec/protocol-tests/input/rest-xml.json

Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@
16741674
},
16751675
"documentation": "<p>This examples adds headers to the input of a request and response by prefix.</p>"
16761676
},
1677-
"description": "No prefix headers are serialized because the value is empty",
1677+
"description": "No prefix headers are serialized because the value is not present",
16781678
"params": {
16791679
"foo": "Foo",
16801680
"fooMap": {}
@@ -1687,6 +1687,35 @@
16871687
"X-Foo": "Foo"
16881688
}
16891689
}
1690+
},
1691+
{
1692+
"id": "HttpPrefixEmptyHeaders",
1693+
"given": {
1694+
"name": "HttpPrefixHeaders",
1695+
"http": {
1696+
"method": "GET",
1697+
"requestUri": "/HttpPrefixHeaders",
1698+
"responseCode": 200
1699+
},
1700+
"input": {
1701+
"shape": "HttpPrefixHeadersInputOutput"
1702+
},
1703+
"documentation": "<p>This examples adds headers to the input of a request and response by prefix.</p>"
1704+
},
1705+
"description": "Serialize prefix headers were the value is present but empty",
1706+
"params": {
1707+
"fooMap": {
1708+
"Abc": ""
1709+
}
1710+
},
1711+
"serialized": {
1712+
"method": "GET",
1713+
"uri": "/HttpPrefixHeaders",
1714+
"body": "",
1715+
"headers": {
1716+
"X-Foo-Abc": ""
1717+
}
1718+
}
16901719
}
16911720
]
16921721
},
@@ -2750,6 +2779,89 @@
27502779
}
27512780
]
27522781
},
2782+
{
2783+
"description": "Test cases for NestedXmlMapWithXmlName operation",
2784+
"metadata": {
2785+
"protocol": "rest-xml",
2786+
"protocols": [
2787+
"rest-xml"
2788+
],
2789+
"apiVersion": "2019-12-16"
2790+
},
2791+
"shapes": {
2792+
"NestedXmlMapWithXmlNameInputOutput": {
2793+
"type": "structure",
2794+
"members": {
2795+
"nestedXmlMapWithXmlNameMap": {
2796+
"shape": "NestedXmlMapWithXmlNameMap"
2797+
}
2798+
}
2799+
},
2800+
"NestedXmlMapWithXmlNameMap": {
2801+
"type": "map",
2802+
"key": {
2803+
"shape": "String",
2804+
"locationName": "OuterKey"
2805+
},
2806+
"value": {
2807+
"shape": "NestedXmlMapWithXmlNameInnerMap"
2808+
}
2809+
},
2810+
"NestedXmlMapWithXmlNameInnerMap": {
2811+
"type": "map",
2812+
"key": {
2813+
"shape": "String",
2814+
"locationName": "InnerKey"
2815+
},
2816+
"value": {
2817+
"shape": "String",
2818+
"locationName": "InnerValue"
2819+
}
2820+
},
2821+
"String": {
2822+
"type": "string"
2823+
}
2824+
},
2825+
"cases": [
2826+
{
2827+
"id": "NestedXmlMapWithXmlNameSerializes",
2828+
"given": {
2829+
"name": "NestedXmlMapWithXmlName",
2830+
"http": {
2831+
"method": "POST",
2832+
"requestUri": "/NestedXmlMapWithXmlName",
2833+
"responseCode": 200
2834+
},
2835+
"input": {
2836+
"shape": "NestedXmlMapWithXmlNameInputOutput",
2837+
"locationName": "NestedXmlMapWithXmlNameRequest"
2838+
},
2839+
"documentation": "<p>Nested Xml Maps with key/values with @xmlName</p>"
2840+
},
2841+
"description": "Serializes nested XML Maps in requests that have xmlName on members",
2842+
"params": {
2843+
"nestedXmlMapWithXmlNameMap": {
2844+
"foo": {
2845+
"bar": "Baz",
2846+
"fizz": "Buzz"
2847+
},
2848+
"qux": {
2849+
"foobar": "Bar",
2850+
"fizzbuzz": "Buzz"
2851+
}
2852+
}
2853+
},
2854+
"serialized": {
2855+
"method": "POST",
2856+
"uri": "/NestedXmlMapWithXmlName",
2857+
"body": " <NestedXmlMapWithXmlNameInputOutput>\n <nestedXmlMapWithXmlNameMap>\n <entry>\n <OuterKey>foo</OuterKey>\n <value>\n <entry>\n <InnerKey>bar</InnerKey>\n <InnerValue>Baz</InnerValue>\n </entry>\n <entry>\n <InnerKey>fizz</InnerKey>\n <InnerValue>Buzz</InnerValue>\n </entry>\n </value>\n </entry>\n <entry>\n <OuterKey>qux</OuterKey>\n <value>\n <entry>\n <InnerKey>foobar</InnerKey>\n <InnerValue>Bar</InnerValue>\n </entry>\n <entry>\n <InnerKey>fizzbuzz</InnerKey>\n <InnerValue>Buzz</InnerValue>\n </entry>\n </value>\n </entry>\n </nestedXmlMapWithXmlNameMap>\n </NestedXmlMapWithXmlNameInputOutput>\n",
2858+
"headers": {
2859+
"Content-Type": "application/xml"
2860+
}
2861+
}
2862+
}
2863+
]
2864+
},
27532865
{
27542866
"description": "Test cases for NoInputAndNoOutput operation",
27552867
"metadata": {
@@ -2869,7 +2981,7 @@
28692981
},
28702982
"documentation": "<p>Null and empty headers are not sent over the wire.</p>"
28712983
},
2872-
"description": "Do not send null values, empty strings, or empty lists over the wire in headers",
2984+
"description": "Do not send null values, but do send empty strings and empty lists over the wire in headers",
28732985
"params": {
28742986
"a": null,
28752987
"b": "",
@@ -2879,10 +2991,12 @@
28792991
"method": "GET",
28802992
"uri": "/NullAndEmptyHeadersClient",
28812993
"body": "",
2994+
"headers": {
2995+
"X-B": "",
2996+
"X-C": ""
2997+
},
28822998
"forbidHeaders": [
2883-
"X-A",
2884-
"X-B",
2885-
"X-C"
2999+
"X-A"
28863000
]
28873001
}
28883002
}

build_tools/aws-sdk-code-generator/spec/protocol-tests/input/smithy-rpc-v2-cbor.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"uri": "/service/RpcV2Protocol/operation/EmptyInputOutput",
3636
"body": "v/8=",
3737
"headers": {
38+
"Accept": "application/cbor",
3839
"Content-Type": "application/cbor",
3940
"smithy-protocol": "rpc-v2-cbor"
4041
},
@@ -76,6 +77,7 @@
7677
"uri": "/service/RpcV2Protocol/operation/NoInputOutput",
7778
"body": "",
7879
"headers": {
80+
"Accept": "application/cbor",
7981
"smithy-protocol": "rpc-v2-cbor"
8082
},
8183
"forbidHeaders": [
@@ -129,6 +131,7 @@
129131
"uri": "/service/RpcV2Protocol/operation/OptionalInputOutput",
130132
"body": "v/8=",
131133
"headers": {
134+
"Accept": "application/cbor",
132135
"Content-Type": "application/cbor",
133136
"smithy-protocol": "rpc-v2-cbor"
134137
},
@@ -217,6 +220,7 @@
217220
"uri": "/service/RpcV2Protocol/operation/RecursiveShapes",
218221
"body": "v2ZuZXN0ZWS/Y2Zvb2RGb28xZm5lc3RlZL9jYmFyZEJhcjFvcmVjdXJzaXZlTWVtYmVyv2Nmb29kRm9vMmZuZXN0ZWS/Y2JhcmRCYXIy//////8=",
219222
"headers": {
223+
"Accept": "application/cbor",
220224
"Content-Type": "application/cbor",
221225
"smithy-protocol": "rpc-v2-cbor"
222226
},
@@ -359,6 +363,7 @@
359363
"uri": "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps",
360364
"body": "oW5kZW5zZVN0cnVjdE1hcKJjZm9voWJoaWV0aGVyZWNiYXqhYmhpY2J5ZQ==",
361365
"headers": {
366+
"Accept": "application/cbor",
362367
"Content-Type": "application/cbor",
363368
"smithy-protocol": "rpc-v2-cbor"
364369
},
@@ -394,6 +399,7 @@
394399
"uri": "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps",
395400
"body": "om5kZW5zZU51bWJlck1hcKFheABvZGVuc2VCb29sZWFuTWFwoWF49A==",
396401
"headers": {
402+
"Accept": "application/cbor",
397403
"Content-Type": "application/cbor",
398404
"smithy-protocol": "rpc-v2-cbor"
399405
},
@@ -430,6 +436,7 @@
430436
"uri": "/service/RpcV2Protocol/operation/RpcV2CborDenseMaps",
431437
"body": "oWtkZW5zZVNldE1hcKJheIBheYJhYWFi",
432438
"headers": {
439+
"Accept": "application/cbor",
433440
"Content-Type": "application/cbor",
434441
"smithy-protocol": "rpc-v2-cbor"
435442
},
@@ -665,6 +672,7 @@
665672
"uri": "/service/RpcV2Protocol/operation/RpcV2CborLists",
666673
"body": "v2pzdHJpbmdMaXN0gmNmb29jYmFyaXN0cmluZ1NldIJjZm9vY2JhcmtpbnRlZ2VyTGlzdIIBAmtib29sZWFuTGlzdIL19G10aW1lc3RhbXBMaXN0gsH7QdTX+/OAAADB+0HU1/vzgAAAaGVudW1MaXN0gmNGb29hMGtpbnRFbnVtTGlzdIIBAnBuZXN0ZWRTdHJpbmdMaXN0goJjZm9vY2JhcoJjYmF6Y3F1eG1zdHJ1Y3R1cmVMaXN0gqJhYWExYWJhMqJhYWEzYWJhNGhibG9iTGlzdIJDZm9vQ2Jhcv8=",
667674
"headers": {
675+
"Accept": "application/cbor",
668676
"Content-Type": "application/cbor",
669677
"smithy-protocol": "rpc-v2-cbor"
670678
},
@@ -696,6 +704,7 @@
696704
"uri": "/service/RpcV2Protocol/operation/RpcV2CborLists",
697705
"body": "v2pzdHJpbmdMaXN0n///",
698706
"headers": {
707+
"Accept": "application/cbor",
699708
"Content-Type": "application/cbor",
700709
"smithy-protocol": "rpc-v2-cbor"
701710
},
@@ -727,6 +736,7 @@
727736
"uri": "/service/RpcV2Protocol/operation/RpcV2CborLists",
728737
"body": "oWpzdHJpbmdMaXN0gA==",
729738
"headers": {
739+
"Accept": "application/cbor",
730740
"Content-Type": "application/cbor",
731741
"smithy-protocol": "rpc-v2-cbor"
732742
},
@@ -841,6 +851,7 @@
841851
"uri": "/service/RpcV2Protocol/operation/SimpleScalarProperties",
842852
"body": "v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==",
843853
"headers": {
854+
"Accept": "application/cbor",
844855
"Content-Type": "application/cbor",
845856
"smithy-protocol": "rpc-v2-cbor"
846857
},
@@ -870,6 +881,7 @@
870881
"uri": "/service/RpcV2Protocol/operation/SimpleScalarProperties",
871882
"body": "v/8=",
872883
"headers": {
884+
"Accept": "application/cbor",
873885
"Content-Type": "application/cbor",
874886
"smithy-protocol": "rpc-v2-cbor"
875887
},
@@ -900,6 +912,7 @@
900912
"uri": "/service/RpcV2Protocol/operation/SimpleScalarProperties",
901913
"body": "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/",
902914
"headers": {
915+
"Accept": "application/cbor",
903916
"Content-Type": "application/cbor",
904917
"smithy-protocol": "rpc-v2-cbor"
905918
},
@@ -930,6 +943,7 @@
930943
"uri": "/service/RpcV2Protocol/operation/SimpleScalarProperties",
931944
"body": "v2tkb3VibGVWYWx1Zft/8AAAAAAAAGpmbG9hdFZhbHVl+n+AAAD/",
932945
"headers": {
946+
"Accept": "application/cbor",
933947
"Content-Type": "application/cbor",
934948
"smithy-protocol": "rpc-v2-cbor"
935949
},
@@ -960,6 +974,7 @@
960974
"uri": "/service/RpcV2Protocol/operation/SimpleScalarProperties",
961975
"body": "v2tkb3VibGVWYWx1Zfv/8AAAAAAAAGpmbG9hdFZhbHVl+v+AAAD/",
962976
"headers": {
977+
"Accept": "application/cbor",
963978
"Content-Type": "application/cbor",
964979
"smithy-protocol": "rpc-v2-cbor"
965980
},

0 commit comments

Comments
 (0)