From 5592e6bd0fd8ea1eaa75bd6323a4ff5126575969 Mon Sep 17 00:00:00 2001 From: Aaron J Todd Date: Tue, 15 Jun 2021 08:56:53 -0400 Subject: [PATCH 1/3] add new awsQuery tests for nested structs and fix endpoint test - Adds tests lists/maps in a nested structure - Fix the expected version of the `AwsQueryEndpointTrait` test --- .../model/awsQuery/endpoints.smithy | 2 +- .../model/awsQuery/input-lists.smithy | 23 ++++++++++++++++ .../model/awsQuery/input-maps.smithy | 26 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/smithy-aws-protocol-tests/model/awsQuery/endpoints.smithy b/smithy-aws-protocol-tests/model/awsQuery/endpoints.smithy index b84d0a8d6cc..82553ead80e 100644 --- a/smithy-aws-protocol-tests/model/awsQuery/endpoints.smithy +++ b/smithy-aws-protocol-tests/model/awsQuery/endpoints.smithy @@ -20,7 +20,7 @@ use smithy.test#httpRequestTests headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: "Action=EndpointOperation&Version=2020-01-0", + body: "Action=EndpointOperation&Version=2020-01-08", bodyMediaType: "application/x-www-form-urlencoded", host: "example.com", resolvedHost: "foo.example.com", diff --git a/smithy-aws-protocol-tests/model/awsQuery/input-lists.smithy b/smithy-aws-protocol-tests/model/awsQuery/input-lists.smithy index 5607d67416c..2ec97325581 100644 --- a/smithy-aws-protocol-tests/model/awsQuery/input-lists.smithy +++ b/smithy-aws-protocol-tests/model/awsQuery/input-lists.smithy @@ -100,6 +100,23 @@ apply QueryLists @httpRequestTests([ FlattenedListArgWithXmlName: ["A", "B"] } }, + { + id: "QueryNestedStructWithList", + documentation: "Nested structure with a list member", + protocol: awsQuery, + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: "Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.member.1=A&NestedWithList.ListArg.member.2=B", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + NestedWithList: { + ListArg: ["A", "B"] + } + } + }, ]) structure QueryListsInput { @@ -115,9 +132,15 @@ structure QueryListsInput { @xmlFlattened @xmlName("Hi") FlattenedListArgWithXmlName: ListWithXmlName, + + NestedWithList: NestedStructWithList } list ListWithXmlName { @xmlName("item") member: String } + +structure NestedStructWithList { + ListArg: StringList +} diff --git a/smithy-aws-protocol-tests/model/awsQuery/input-maps.smithy b/smithy-aws-protocol-tests/model/awsQuery/input-maps.smithy index 1ff39512e5a..45ac6f39a71 100644 --- a/smithy-aws-protocol-tests/model/awsQuery/input-maps.smithy +++ b/smithy-aws-protocol-tests/model/awsQuery/input-maps.smithy @@ -167,6 +167,26 @@ apply QueryMaps @httpRequestTests([ } } }, + { + id: "QueryNestedStructWithMap", + documentation: "Serializes nested struct with map member", + protocol: awsQuery, + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: "Action=QueryMaps&Version=2020-01-08&NestedStructWithMap.MapArg.entry.1.key=bar&NestedStructWithMap.MapArg.entry.1.value=Bar&NestedStructWithMap.MapArg.entry.2.key=foo&NestedStructWithMap.MapArg.entry.2.value=Foo", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + NestedStructWithMap: { + MapArg: { + bar: "Bar", + foo: "Foo", + } + } + } + }, ]) structure QueryMapsInput { @@ -187,6 +207,8 @@ structure QueryMapsInput { FlattenedMapWithXmlName: MapWithXmlName, MapOfLists: MapOfLists, + + NestedStructWithMap: NestedStructWithMap, } map ComplexMap { @@ -206,3 +228,7 @@ map MapOfLists { key: String, value: StringList, } + +structure NestedStructWithMap { + MapArg: StringMap +} From 0affada665e8c2f733dc1908e64e0b41f33ab852 Mon Sep 17 00:00:00 2001 From: Aaron J Todd Date: Tue, 15 Jun 2021 12:45:57 -0400 Subject: [PATCH 2/3] add ec2 test for nested struct with list member --- .../model/ec2Query/input-lists.smithy | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy b/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy index 5ee768889e5..fee791443fb 100644 --- a/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy +++ b/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy @@ -85,6 +85,23 @@ apply QueryLists @httpRequestTests([ ListArgWithXmlName: ["A", "B"] } }, + { + id: "Ec2ListNestedStructWithList", + documentation: "Nested structure with a list member", + protocol: ec2Query, + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: "Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.member.1=A&NestedWithList.ListArg.member.2=B", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + NestedWithList: { + ListArg: ["A", "B"] + } + } + }, ]) structure QueryListsInput { @@ -96,9 +113,15 @@ structure QueryListsInput { @xmlName("Hi") ListArgWithXmlName: ListWithXmlName, + + NestedWithList: NestedStructWithList, } list ListWithXmlName { @xmlName("item") member: String } + +structure NestedStructWithList { + ListArg: StringList +} From 51e54b777374169df64863b11d445800f597639b Mon Sep 17 00:00:00 2001 From: Aaron J Todd Date: Wed, 16 Jun 2021 09:41:38 -0400 Subject: [PATCH 3/3] fix Ec2ListNestedStructWithList expected body --- smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy b/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy index fee791443fb..3eb3a1917a1 100644 --- a/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy +++ b/smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy @@ -94,7 +94,7 @@ apply QueryLists @httpRequestTests([ headers: { "Content-Type": "application/x-www-form-urlencoded" }, - body: "Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.member.1=A&NestedWithList.ListArg.member.2=B", + body: "Action=QueryLists&Version=2020-01-08&NestedWithList.ListArg.1=A&NestedWithList.ListArg.2=B", bodyMediaType: "application/x-www-form-urlencoded", params: { NestedWithList: {