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 rest xml protocol tests for nested maps #777

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
150 changes: 150 additions & 0 deletions smithy-aws-protocol-tests/model/restXml/document-maps.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,153 @@ map FlattenedXmlMapWithXmlNamespaceOutputMap {
@xmlNamespace(uri: "https://the-value.example.com")
value: String,
}

@http(uri: "/NestedXmlMaps", method: "POST")
operation NestedXmlMaps {
input: NestedXmlMapsInputOutput,
output: NestedXmlMapsInputOutput,
}

structure NestedXmlMapsInputOutput {
nestedMap: NestedMap,

@xmlFlattened
flatNestedMap: NestedMap,
}

map NestedMap {
key: String,
value: FooEnumMap,
}

apply NestedXmlMaps @httpRequestTests([
{
id: "NestedXmlMapRequest",
documentation: "Tests requests with nested maps.",
protocol: restXml,
method: "POST",
uri: "/NestedXmlMaps",
body: """
<NestedXmlMapsInputOutput>
<nestedMap>
<entry>
<key>foo</key>
<value>
<entry>
<key>bar</key>
<value>Bar</value>
</entry>
</value>
</entry>
</nestedMap>
</NestedXmlMapsInputOutput>""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
},
params: {
nestedMap: {
foo: {
bar: "Bar",
}
}
}
},
{
id: "FlatNestedXmlMapRequest",
documentation: """
Tests requests with nested flat maps. Since maps can only be
flattened when they're structure members, only the outer map is flat.""",
protocol: restXml,
method: "POST",
uri: "/NestedXmlMaps",
body: """
<NestedXmlMapsInputOutput>
<flatNestedMap>
<key>foo</key>
<value>
<entry>
<key>bar</key>
<value>Bar</value>
</entry>
</value>
</flatNestedMap>
</NestedXmlMapsInputOutput>""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
},
params: {
flatNestedMap: {
foo: {
bar: "Bar",
}
}
}
},
])

apply NestedXmlMaps @httpResponseTests([
{
id: "NestedXmlMapResponse",
documentation: "Tests responses with nested maps.",
protocol: restXml,
code: 200,
body: """
<NestedXmlMapsInputOutput>
<nestedMap>
<entry>
<key>foo</key>
<value>
<entry>
<key>bar</key>
<value>Bar</value>
</entry>
</value>
</entry>
</nestedMap>
</NestedXmlMapsInputOutput>""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
},
params: {
nestedMap: {
foo: {
bar: "Bar",
}
}
}
},
{
id: "FlatNestedXmlMapResponse",
documentation: """
Tests responses with nested flat maps. Since maps can only be
flattened when they're structure members, only the outer map is flat.""",
protocol: restXml,
code: 200,
body: """
<NestedXmlMapsInputOutput>
<flatNestedMap>
<key>foo</key>
<value>
<entry>
<key>bar</key>
<value>Bar</value>
</entry>
</value>
</flatNestedMap>
</NestedXmlMapsInputOutput>""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
},
params: {
flatNestedMap: {
foo: {
bar: "Bar",
}
}
}
},
])
1 change: 1 addition & 0 deletions smithy-aws-protocol-tests/model/restXml/main.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ service RestXml {
XmlLists,
XmlMaps,
XmlMapsXmlName,
NestedXmlMaps,
FlattenedXmlMap,
FlattenedXmlMapWithXmlName,
FlattenedXmlMapWithXmlNamespace,
Expand Down