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 XML string payload protocol test #2007

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use smithy.test#httpResponseTests
@http(uri: "/EnumPayload", method: "POST")
@httpRequestTests([
{
id: "EnumPayloadRequest",
id: "RestJsonEnumPayloadRequest",
uri: "/EnumPayload",
body: "enumvalue",
params: { payload: "enumvalue" },
Expand All @@ -18,7 +18,7 @@ use smithy.test#httpResponseTests
])
@httpResponseTests([
{
id: "EnumPayloadResponse",
id: "RestJsonEnumPayloadResponse",
body: "enumvalue",
params: { payload: "enumvalue" },
protocol: "aws.protocols#restJson1",
Expand All @@ -42,7 +42,7 @@ enum StringEnum {
@http(uri: "/StringPayload", method: "POST")
@httpRequestTests([
{
id: "StringPayloadRequest",
id: "RestJsonStringPayloadRequest",
uri: "/StringPayload",
body: "rawstring",
params: { payload: "rawstring" },
Expand All @@ -52,7 +52,7 @@ enum StringEnum {
])
@httpResponseTests([
{
id: "StringPayloadResponse",
id: "RestJsonStringPayloadResponse",
body: "rawstring",
params: { payload: "rawstring" },
protocol: "aws.protocols#restJson1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
$version: "2.0"

namespace aws.protocoltests.restXml

use smithy.test#httpRequestTests
use smithy.test#httpResponseTests

@http(uri: "/EnumPayload", method: "POST")
@httpRequestTests([
{
id: "RestXmlEnumPayloadRequest",
uri: "/EnumPayload",
body: "enumvalue",
params: { payload: "enumvalue" },
method: "POST",
protocol: "aws.protocols#restXml"
}
])
@httpResponseTests([
{
id: "RestXmlEnumPayloadResponse",
body: "enumvalue",
params: { payload: "enumvalue" },
protocol: "aws.protocols#restXml",
code: 200
}
])
operation HttpEnumPayload {
Copy link
Contributor

Choose a reason for hiding this comment

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

This operation and the one below need to be added to the RestXml service, otherwise code generators won't pick it up and generate the appropriate tests from it. See where the equivalent operations are added to the RestJson service here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added operations and fixed namespace

input: EnumPayloadInput,
output: EnumPayloadInput
}

structure EnumPayloadInput {
@httpPayload
payload: StringEnum
}

enum StringEnum {
V = "enumvalue"
}

@http(uri: "/StringPayload", method: "POST")
@httpRequestTests([
{
id: "RestXmlStringPayloadRequest",
uri: "/StringPayload",
body: "rawstring",
params: { payload: "rawstring" },
method: "POST",
protocol: "aws.protocols#restXml"
}
])
@httpResponseTests([
{
id: "RestXmlStringPayloadResponse",
body: "rawstring",
params: { payload: "rawstring" },
protocol: "aws.protocols#restXml",
code: 200
}
])
operation HttpStringPayload {
input: StringPayloadInput,
output: StringPayloadInput
}

structure StringPayloadInput {
@httpPayload
payload: String
}