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 complex, unflattened restXml map test #1909

Merged
merged 1 commit into from
Aug 31, 2023
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
88 changes: 88 additions & 0 deletions smithy-aws-protocol-tests/model/restXml/document-maps.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -639,3 +639,91 @@ apply NestedXmlMaps @httpResponseTests([
}
},
])

/// Maps with @xmlNamespace and @xmlName
@http(uri: "/XmlMapWithXmlNamespace", method: "POST")
operation XmlMapWithXmlNamespace {
input: XmlMapWithXmlNamespaceInputOutput
output: XmlMapWithXmlNamespaceInputOutput
}

apply XmlMapWithXmlNamespace @httpRequestTests([
{
id: "RestXmlXmlMapWithXmlNamespace",
documentation: "Serializes XML maps in requests that have xmlNamespace and xmlName on members",
protocol: restXml,
method: "POST",
uri: "/XmlMapWithXmlNamespace",
body: """
<XmlMapWithXmlNamespaceInputOutput>
<KVP xmlns="https://the-member.example.com">
<entry>
<K xmlns="https://the-key.example.com">a</K>
<V xmlns="https://the-value.example.com">A</V>
</entry>
<entry>
<K xmlns="https://the-key.example.com">b</K>
<V xmlns="https://the-value.example.com">B</V>
</entry>
</KVP>
</XmlMapWithXmlNamespaceInputOutput>""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
params: {
myMap: {
a: "A",
b: "B",
}
}
}
])

apply XmlMapWithXmlNamespace @httpResponseTests([
{
id: "RestXmlXmlMapWithXmlNamespace",
documentation: "Serializes XML maps in responses that have xmlNamespace and xmlName on members",
protocol: restXml,
code: 200,
body: """
<XmlMapWithXmlNamespaceInputOutput>
<KVP xmlns="https://the-member.example.com">
<entry>
<K xmlns="https://the-key.example.com">a</K>
<V xmlns="https://the-value.example.com">A</V>
</entry>
<entry>
<K xmlns="https://the-key.example.com">b</K>
<V xmlns="https://the-value.example.com">B</V>
</entry>
</KVP>
</XmlMapWithXmlNamespaceInputOutput>""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
params: {
myMap: {
a: "A",
b: "B",
}
}
}
])

structure XmlMapWithXmlNamespaceInputOutput {
@xmlName("KVP")
@xmlNamespace(uri: "https://the-member.example.com")
myMap: XmlMapWithXmlNamespaceInputOutputMap,
}

map XmlMapWithXmlNamespaceInputOutputMap {
@xmlName("K")
@xmlNamespace(uri: "https://the-key.example.com")
key: String,

@xmlName("V")
@xmlNamespace(uri: "https://the-value.example.com")
value: String,
}
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 @@ -80,6 +80,7 @@ service RestXml {
FlattenedXmlMap,
FlattenedXmlMapWithXmlName,
FlattenedXmlMapWithXmlNamespace,
XmlMapWithXmlNamespace,

// @xmlAttribute tests
XmlAttributes,
Expand Down