Skip to content

Commit 716b66d

Browse files
Chase Coalwellsrchase
Chase Coalwell
authored andcommitted
Prefer member xmlName for httpPayloads
1 parent 4952c86 commit 716b66d

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

smithy-aws-protocol-tests/model/restXml/http-payload.smithy

+58
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,64 @@ structure PayloadWithXmlName {
285285
name: String
286286
}
287287

288+
/// The following example serializes a payload that uses an XML name
289+
/// on the member, changing the wrapper name.
290+
291+
@idempotent
292+
@http(uri: "/HttpPayloadWithMemberXmlName", method: "PUT")
293+
operation HttpPayloadWithMemberXmlName {
294+
input: HttpPayloadWithMemberXmlNameInputOutput,
295+
output: HttpPayloadWithMemberXmlNameInputOutput
296+
}
297+
298+
apply HttpPayloadWithMemberXmlName @httpRequestTests([
299+
{
300+
id: "HttpPayloadWithMemberXmlName",
301+
documentation: "Serializes a structure in the payload using a wrapper name based on member xmlName",
302+
protocol: restXml,
303+
method: "PUT",
304+
uri: "/HttpPayloadWithMemberXmlName",
305+
body: "<Hola><name>Phreddy</name></Hola>",
306+
bodyMediaType: "application/xml",
307+
headers: {
308+
"Content-Type": "application/xml"
309+
},
310+
requireHeaders: [
311+
"Content-Length"
312+
],
313+
params: {
314+
nested: {
315+
name: "Phreddy"
316+
}
317+
}
318+
}
319+
])
320+
321+
apply HttpPayloadWithMemberXmlName @httpResponseTests([
322+
{
323+
id: "HttpPayloadWithMemberXmlName",
324+
documentation: "Serializes a structure in the payload using a wrapper name based on member xmlName",
325+
protocol: restXml,
326+
code: 200,
327+
body: "<Hola><name>Phreddy</name></Hola>",
328+
bodyMediaType: "application/xml",
329+
headers: {
330+
"Content-Type": "application/xml"
331+
},
332+
params: {
333+
nested: {
334+
name: "Phreddy"
335+
}
336+
}
337+
}
338+
])
339+
340+
structure HttpPayloadWithMemberXmlNameInputOutput {
341+
@httpPayload
342+
@xmlName("Hola")
343+
nested: PayloadWithXmlName,
344+
}
345+
288346
/// The following example serializes a payload that uses an XML namespace.
289347
@idempotent
290348
@http(uri: "/HttpPayloadWithXmlNamespace", method: "PUT")

smithy-aws-protocol-tests/model/restXml/main.smithy

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ service RestXml {
5050
HttpPayloadTraitsWithMediaType,
5151
HttpPayloadWithStructure,
5252
HttpPayloadWithXmlName,
53+
HttpPayloadWithMemberXmlName,
5354
HttpPayloadWithXmlNamespace,
5455
HttpPayloadWithXmlNamespaceAndPrefix,
5556

0 commit comments

Comments
 (0)