Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new awsQuery tests for nested structs and fix endpoint test #833

Merged
merged 3 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 23 additions & 0 deletions smithy-aws-protocol-tests/model/awsQuery/input-lists.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -115,9 +132,15 @@ structure QueryListsInput {
@xmlFlattened
@xmlName("Hi")
FlattenedListArgWithXmlName: ListWithXmlName,

NestedWithList: NestedStructWithList
}

list ListWithXmlName {
@xmlName("item")
member: String
}

structure NestedStructWithList {
ListArg: StringList
}
26 changes: 26 additions & 0 deletions smithy-aws-protocol-tests/model/awsQuery/input-maps.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -187,6 +207,8 @@ structure QueryMapsInput {
FlattenedMapWithXmlName: MapWithXmlName,

MapOfLists: MapOfLists,

NestedStructWithMap: NestedStructWithMap,
}

map ComplexMap {
Expand All @@ -206,3 +228,7 @@ map MapOfLists {
key: String,
value: StringList,
}

structure NestedStructWithMap {
MapArg: StringMap
}
23 changes: 23 additions & 0 deletions smithy-aws-protocol-tests/model/ec2Query/input-lists.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ec2 doesn't have the member segment - it looks like our docs are actually wrong on this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh good catch, haven't implemented EC2 protocol yet and missed that difference.

bodyMediaType: "application/x-www-form-urlencoded",
params: {
NestedWithList: {
ListArg: ["A", "B"]
}
}
},
])

structure QueryListsInput {
Expand All @@ -96,9 +113,15 @@ structure QueryListsInput {

@xmlName("Hi")
ListArgWithXmlName: ListWithXmlName,

NestedWithList: NestedStructWithList,
}

list ListWithXmlName {
@xmlName("item")
member: String
}

structure NestedStructWithList {
ListArg: StringList
}