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

Nested xml map with xml name #2236

Merged
merged 4 commits into from
Apr 16, 2024
Merged
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
145 changes: 145 additions & 0 deletions smithy-aws-protocol-tests/model/restXml/document-maps.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,151 @@ apply NestedXmlMaps @httpResponseTests([
},
])

/// Nested Xml Maps with key/values with @xmlName
@http(uri: "/NestedXmlMapWithXmlName", method: "POST")
operation NestedXmlMapWithXmlName {
input: NestedXmlMapWithXmlNameInputOutput
output: NestedXmlMapWithXmlNameInputOutput
}

structure NestedXmlMapWithXmlNameInputOutput {
nestedXmlMapWithXmlNameMap: NestedXmlMapWithXmlNameMap
}

map NestedXmlMapWithXmlNameMap{
@xmlName("OuterKey")
key: String

value: NestedXmlMapWithXmlNameInnerMap
}

map NestedXmlMapWithXmlNameInnerMap{
@xmlName("InnerKey")
key: String

@xmlName("InnerValue")
value: String
}

apply NestedXmlMapWithXmlName @httpRequestTests([
{
id : "NestedXmlMapWithXmlNameSerializes",
documentation : "Serializes nested XML Maps in requests that have xmlName on members",
protocol: restXml,
method: "POST",
uri: "/NestedXmlMapWithXmlName",
body: """
<NestedXmlMapWithXmlNameRequest>
<nestedXmlMapWithXmlNameMap>
<entry>
<OuterKey>foo</OuterKey>
<value>
<entry>
<InnerKey>bar</InnerKey>
<InnerValue>Baz</InnerValue>
</entry>
<entry>
<InnerKey>fizz</InnerKey>
<InnerValue>Buzz</InnerValue>
</entry>
</value>
</entry>
<entry>
<OuterKey>qux</OuterKey>
<value>
<entry>
<InnerKey>foobar</InnerKey>
<InnerValue>Bar</InnerValue>
</entry>
<entry>
<InnerKey>fizzbuzz</InnerKey>
<InnerValue>Buzz</InnerValue>
</entry>
</value>
</entry>
</nestedXmlMapWithXmlNameMap>
</NestedXmlMapWithXmlNameRequest>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml",
},
params: {
nestedXmlMapWithXmlNameMap: {
foo: {
bar: "Baz",
fizz: "Buzz"
},
qux: {
foobar: "Bar",
fizzbuzz: "Buzz"
}
}
}
}




])

apply NestedXmlMapWithXmlName @httpResponseTests([
Copy link
Contributor

Choose a reason for hiding this comment

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

Should have an @httpRequestTests application as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the request test

{
id: "NestedXmlMapWithXmlNameDeserializes",
documentation: "Serializes nested XML maps in responses that have xmlName on members",
protocol: restXml,
code: 200,
body: """
<NestedXmlMapWithXmlNameResponse>
<nestedXmlMapWithXmlNameMap>
<entry>
<OuterKey>foo</OuterKey>
<value>
<entry>
<InnerKey>bar</InnerKey>
<InnerValue>Baz</InnerValue>
</entry>
<entry>
<InnerKey>fizz</InnerKey>
<InnerValue>Buzz</InnerValue>
</entry>
</value>
</entry>
<entry>
<OuterKey>qux</OuterKey>
<value>
<entry>
<InnerKey>foobar</InnerKey>
<InnerValue>Bar</InnerValue>
</entry>
<entry>
<InnerKey>fizzbuzz</InnerKey>
<InnerValue>Buzz</InnerValue>
</entry>
</value>
</entry>
</nestedXmlMapWithXmlNameMap>
</NestedXmlMapWithXmlNameResponse>
"""
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
}
params: {
nestedXmlMapWithXmlNameMap: {
foo: {
bar: "Baz",
fizz: "Buzz"
},
qux: {
foobar: "Bar",
fizzbuzz: "Buzz"
}
}
}
}
])

/// Maps with @xmlNamespace and @xmlName
@http(uri: "/XmlMapWithXmlNamespace", method: "POST")
operation XmlMapWithXmlNamespace {
Expand Down