From 97d9b58369ce5555a7a5b447834918b3cc9d5021 Mon Sep 17 00:00:00 2001 From: kstich Date: Fri, 4 Aug 2023 12:11:12 -0700 Subject: [PATCH] Add complex, unflattened restXml map test --- .../model/restXml/document-maps.smithy | 88 +++++++++++++++++++ .../model/restXml/main.smithy | 1 + 2 files changed, 89 insertions(+) diff --git a/smithy-aws-protocol-tests/model/restXml/document-maps.smithy b/smithy-aws-protocol-tests/model/restXml/document-maps.smithy index bfbf0963ecc..8ed07a6f05c 100644 --- a/smithy-aws-protocol-tests/model/restXml/document-maps.smithy +++ b/smithy-aws-protocol-tests/model/restXml/document-maps.smithy @@ -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: """ + + + + a + A + + + b + B + + + """, + 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: """ + + + + a + A + + + b + B + + + """, + 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, +} diff --git a/smithy-aws-protocol-tests/model/restXml/main.smithy b/smithy-aws-protocol-tests/model/restXml/main.smithy index 949a2658802..25a7ed7810e 100644 --- a/smithy-aws-protocol-tests/model/restXml/main.smithy +++ b/smithy-aws-protocol-tests/model/restXml/main.smithy @@ -80,6 +80,7 @@ service RestXml { FlattenedXmlMap, FlattenedXmlMapWithXmlName, FlattenedXmlMapWithXmlNamespace, + XmlMapWithXmlNamespace, // @xmlAttribute tests XmlAttributes,