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

Prefer member xmlName for httpPayloads #744

Merged
merged 1 commit into from
Mar 29, 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
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