Skip to content

Commit

Permalink
Add complex, unflattened restXml map test
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Aug 4, 2023
1 parent 023dd2b commit 97d9b58
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
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: "/FlattenedXmlMapWithXmlName",
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

0 comments on commit 97d9b58

Please sign in to comment.