Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add structure xmlName wrapper test #789

Merged
merged 1 commit into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You sure this isn't supposed to be: <Ahoy><nested><name>Phreddy</name></nested></Ahoy>?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was fixed in #795

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