Skip to content

Commit

Permalink
Prefer member xmlName for httpPayloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell authored and srchase committed Mar 29, 2021
1 parent 4952c86 commit 716b66d
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
58 changes: 58 additions & 0 deletions smithy-aws-protocol-tests/model/restXml/http-payload.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,64 @@ structure PayloadWithXmlName {
name: String
}

/// The following example serializes a payload that uses an XML name
/// on the member, changing the wrapper name.

@idempotent
@http(uri: "/HttpPayloadWithMemberXmlName", method: "PUT")
operation HttpPayloadWithMemberXmlName {
input: HttpPayloadWithMemberXmlNameInputOutput,
output: HttpPayloadWithMemberXmlNameInputOutput
}

apply HttpPayloadWithMemberXmlName @httpRequestTests([
{
id: "HttpPayloadWithMemberXmlName",
documentation: "Serializes a structure in the payload using a wrapper name based on member xmlName",
protocol: restXml,
method: "PUT",
uri: "/HttpPayloadWithMemberXmlName",
body: "<Hola><name>Phreddy</name></Hola>",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
requireHeaders: [
"Content-Length"
],
params: {
nested: {
name: "Phreddy"
}
}
}
])

apply HttpPayloadWithMemberXmlName @httpResponseTests([
{
id: "HttpPayloadWithMemberXmlName",
documentation: "Serializes a structure in the payload using a wrapper name based on member xmlName",
protocol: restXml,
code: 200,
body: "<Hola><name>Phreddy</name></Hola>",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
params: {
nested: {
name: "Phreddy"
}
}
}
])

structure HttpPayloadWithMemberXmlNameInputOutput {
@httpPayload
@xmlName("Hola")
nested: PayloadWithXmlName,
}

/// The following example serializes a payload that uses an XML namespace.
@idempotent
@http(uri: "/HttpPayloadWithXmlNamespace", method: "PUT")
Expand Down
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 @@ -50,6 +50,7 @@ service RestXml {
HttpPayloadTraitsWithMediaType,
HttpPayloadWithStructure,
HttpPayloadWithXmlName,
HttpPayloadWithMemberXmlName,
HttpPayloadWithXmlNamespace,
HttpPayloadWithXmlNamespaceAndPrefix,

Expand Down

0 comments on commit 716b66d

Please sign in to comment.