Skip to content

Commit

Permalink
Add structure xmlName wrapper test
Browse files Browse the repository at this point in the history
  • Loading branch information
Chase Coalwell authored and srchase committed May 3, 2021
1 parent 036299e commit 336aa91
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
56 changes: 56 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,62 @@ structure PayloadWithXmlName {
name: String
}

/// The following example serializes a body that uses an XML name,
/// changing the wrapper name.
@idempotent
@http(uri: "/BodyWithXmlName", method: "PUT")
operation BodyWithXmlName {
input: BodyWithXmlNameInputOutput,
output: BodyWithXmlNameInputOutput
}

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

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

@xmlName("Ahoy")
structure BodyWithXmlNameInputOutput {
nested: PayloadWithXmlName,
}

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

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,
BodyWithXmlName,
HttpPayloadWithMemberXmlName,
HttpPayloadWithXmlNamespace,
HttpPayloadWithXmlNamespaceAndPrefix,
Expand Down

0 comments on commit 336aa91

Please sign in to comment.