-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,409 additions
and
20 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
...aws-protocol-tests/src/main/resources/META-INF/smithy/ec2-query/empty-input-output.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// This file defines test cases that test the basics of empty input and | ||
// output shape serialization. | ||
|
||
$version: "0.5.0" | ||
|
||
namespace aws.protocols.tests.ec2 | ||
|
||
use smithy.test#httpRequestTests | ||
use smithy.test#httpResponseTests | ||
|
||
/// The example tests how requests and responses are serialized when there's | ||
/// no request payload or response members. | ||
/// | ||
/// While this should be rare, code generators must support this. | ||
operation NoInputAndOutput { | ||
output: NoInputAndOutputOutput | ||
} | ||
|
||
apply NoInputAndOutput @httpRequestTests([ | ||
{ | ||
id: "Ec2QueryNoInputAndOutput", | ||
description: "No input serializes no payload", | ||
protocol: "aws.ec2", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=NoInputAndOutput | ||
&Version=2020-01-08""", | ||
bodyMediaType: "application/x-www-form-urlencoded" | ||
} | ||
]) | ||
|
||
apply NoInputAndOutput @httpResponseTests([ | ||
{ | ||
id: "Ec2QueryNoInputAndOutput", | ||
description: "Empty output", | ||
protocol: "aws.ec2", | ||
code: 200, | ||
headers: { | ||
"Content-Type": "text/xml;charset=UTF-8" | ||
}, | ||
body: """ | ||
<NoInputAndOutputResponse xmlns="https://example.com/"> | ||
<RequestId>requestid</RequestId> | ||
</NoInputAndOutputResponse> | ||
""", | ||
bodyMediaType: "application/xml", | ||
} | ||
]) | ||
|
||
structure NoInputAndOutputOutput {} | ||
|
||
/// The example tests how requests and responses are serialized when there's | ||
/// no request or response members. | ||
/// | ||
/// While this should be rare, code generators must support this. | ||
operation EmptyInputAndEmptyOutput { | ||
input: EmptyInputAndEmptyOutputInput, | ||
output: EmptyInputAndEmptyOutputOutput | ||
} | ||
|
||
apply EmptyInputAndEmptyOutput @httpRequestTests([ | ||
{ | ||
id: "Ec2QueryEmptyInputAndEmptyOutput", | ||
description: "Empty input serializes no extra query params", | ||
protocol: "aws.ec2", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=EmptyInputAndEmptyOutput | ||
&Version=2020-01-08""", | ||
bodyMediaType: "application/x-www-form-urlencoded" | ||
}, | ||
]) | ||
|
||
apply EmptyInputAndEmptyOutput @httpResponseTests([ | ||
{ | ||
id: "Ec2QueryEmptyInputAndEmptyOutput", | ||
description: "Empty output", | ||
protocol: "aws.ec2", | ||
code: 200, | ||
headers: { | ||
"Content-Type": "text/xml;charset=UTF-8" | ||
}, | ||
body: """ | ||
<EmptyInputAndEmptyOutputResponse xmlns="https://example.com/"> | ||
<RequestId>requestid</RequestId> | ||
</EmptyInputAndEmptyOutputResponse> | ||
""", | ||
bodyMediaType: "application/xml", | ||
}, | ||
]) | ||
|
||
structure EmptyInputAndEmptyOutputInput {} | ||
structure EmptyInputAndEmptyOutputOutput {} |
120 changes: 120 additions & 0 deletions
120
smithy-aws-protocol-tests/src/main/resources/META-INF/smithy/ec2-query/input-lists.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// This file defines test cases that test list query serialization. | ||
|
||
$version: "0.5.0" | ||
|
||
namespace aws.protocols.tests.ec2 | ||
|
||
use aws.protocols.tests.shared#EpochSeconds | ||
use aws.protocols.tests.shared#FooEnum | ||
use aws.protocols.tests.shared#GreetingList | ||
use aws.protocols.tests.shared#StringList | ||
use smithy.test#httpRequestTests | ||
|
||
/// This test serializes simple and complex lists. | ||
operation QueryLists { | ||
input: QueryListsInput | ||
} | ||
|
||
apply QueryLists @httpRequestTests([ | ||
{ | ||
id: "Ec2Lists", | ||
description: "Serializes query lists. All EC2 lists are flattened.", | ||
protocol: "aws.ec2", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08 | ||
&ListArg.1=foo | ||
&ListArg.2=bar | ||
&ListArg.3=baz | ||
&ComplexListArg.1.hi=hello | ||
&ComplexListArg.2.hi=hola""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
ListArg: ["foo", "bar", "baz"], | ||
ComplexListArg: [ | ||
{ | ||
hi: "hello" | ||
}, | ||
{ | ||
hi: "hola" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
id: "Ec2EmptyQueryLists", | ||
description: "Does not serialize empty query lists", | ||
protocol: "aws.ec2", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
ListArg: [] | ||
} | ||
}, | ||
{ | ||
id: "Ec2ListArgWithXmlNameMember", | ||
description: "An xmlName trait in the member of a list has no effect on the list serialization.", | ||
protocol: "aws.ec2", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08 | ||
&ListArgWithXmlNameMember.1=A | ||
&ListArgWithXmlNameMember.2=B""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
ListArgWithXmlNameMember: ["A", "B"] | ||
} | ||
}, | ||
{ | ||
id: "Ec2ListMemberWithXmlName", | ||
description: "Changes the name of the list using the xmlName trait", | ||
protocol: "aws.ec2", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08 | ||
&Hi.1=A | ||
&Hi.2=B""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
ListArgWithXmlName: ["A", "B"] | ||
} | ||
}, | ||
]) | ||
|
||
structure QueryListsInput { | ||
ListArg: StringList, | ||
ComplexListArg: GreetingList, | ||
|
||
// Notice that the xmlName on the targeted list member is ignored. | ||
ListArgWithXmlNameMember: ListWithXmlName, | ||
|
||
@xmlName("Hi") | ||
ListArgWithXmlName: ListWithXmlName, | ||
} | ||
|
||
list ListWithXmlName { | ||
@xmlName("item") | ||
member: String | ||
} |
Oops, something went wrong.