-
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
17 changed files
with
1,827 additions
and
10 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
smithy-aws-protocol-tests/model/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,115 @@ | ||
// This file defines test cases that test the basics of empty input and | ||
// output shape serialization. | ||
|
||
$version: "0.5.0" | ||
|
||
namespace aws.protocols.tests.query | ||
|
||
use smithy.test#httpRequestTests | ||
use smithy.test#httpResponseTests | ||
|
||
/// The example tests how requests and responses are serialized when there's | ||
/// no request or response payload because the operation has no input or output. | ||
/// | ||
/// While this should be rare, code generators must support this. | ||
operation NoInputAndNoOutput() | ||
|
||
apply NoInputAndNoOutput @httpRequestTests([ | ||
{ | ||
id: "QueryNoInputAndNoOutput", | ||
description: "No input serializes no additional query params", | ||
protocol: "aws.query", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=NoInputAndNoOutput | ||
&Version=2020-01-08""", | ||
bodyMediaType: "application/x-www-form-urlencoded" | ||
} | ||
]) | ||
|
||
apply NoInputAndNoOutput @httpResponseTests([ | ||
{ | ||
id: "QueryNoInputAndNoOutput", | ||
description: "No output serializes no payload", | ||
protocol: "aws.query", | ||
code: 200, | ||
body: "" | ||
} | ||
]) | ||
|
||
/// The example tests how requests and responses are serialized when there's | ||
/// no request or response payload because the operation has no input and the | ||
/// output is empty. | ||
/// | ||
/// While this should be rare, code generators must support this. | ||
operation NoInputAndOutput() -> NoInputAndOutputOutput | ||
|
||
apply NoInputAndOutput @httpRequestTests([ | ||
{ | ||
id: "QueryNoInputAndOutput", | ||
description: "No input serializes no payload", | ||
protocol: "aws.query", | ||
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: "QueryNoInputAndOutput", | ||
description: "Empty output serializes no payload", | ||
protocol: "aws.query", | ||
code: 200, | ||
body: "" | ||
} | ||
]) | ||
|
||
structure NoInputAndOutputOutput {} | ||
|
||
/// The example tests how requests and responses are serialized when there's | ||
/// no request or response payload because the operation has an empty input | ||
/// and empty output structure that reuses the same shape. | ||
/// | ||
/// While this should be rare, code generators must support this. | ||
operation EmptyInputAndEmptyOutput(EmptyInputAndEmptyOutputInput) -> EmptyInputAndEmptyOutputOutput | ||
|
||
apply EmptyInputAndEmptyOutput @httpRequestTests([ | ||
{ | ||
id: "QueryEmptyInputAndEmptyOutput", | ||
description: "Empty input serializes no extra query params", | ||
protocol: "aws.query", | ||
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: "QueryEmptyInputAndEmptyOutput", | ||
description: "Empty output serializes no payload", | ||
protocol: "aws.query", | ||
code: 200, | ||
body: "" | ||
}, | ||
]) | ||
|
||
structure EmptyInputAndEmptyOutputInput {} | ||
structure EmptyInputAndEmptyOutputOutput {} |
141 changes: 141 additions & 0 deletions
141
smithy-aws-protocol-tests/model/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,141 @@ | ||
// This file defines test cases that test list query serialization. | ||
|
||
$version: "0.5.0" | ||
|
||
namespace aws.protocols.tests.query | ||
|
||
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(QueryListsInput) | ||
|
||
apply QueryLists @httpRequestTests([ | ||
{ | ||
id: "QueryLists", | ||
description: "Serializes query lists", | ||
protocol: "aws.query", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08 | ||
&ListArg.member.1=foo | ||
&ListArg.member.2=bar | ||
&ListArg.member.3=baz | ||
&ComplexListArg.member.1.hi=hello | ||
&ComplexListArg.member.2.hi=hola""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
ListArg: ["foo", "bar", "baz"], | ||
ComplexListArg: [ | ||
{ | ||
hi: "hello" | ||
}, | ||
{ | ||
hi: "hola" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
id: "EmptyQueryLists", | ||
description: "Does not serialize empty query lists", | ||
protocol: "aws.query", | ||
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: "FlattenedQueryLists", | ||
description: "Flattens query lists by repeating the member name and removing the member element", | ||
protocol: "aws.query", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08 | ||
&FlattenedListArg.1=A | ||
&FlattenedListArg.2=B""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
FlattenedListArg: ["A", "B"] | ||
} | ||
}, | ||
{ | ||
id: "QueryListArgWithXmlNameMember", | ||
description: "Changes the member of lists using xmlName trait", | ||
protocol: "aws.query", | ||
method: "POST", | ||
uri: "/", | ||
headers: { | ||
"Content-Type": "application/x-www-form-urlencoded" | ||
}, | ||
body: """ | ||
Action=QueryLists | ||
&Version=2020-01-08 | ||
&ListArgWithXmlNameMember.item.1=A | ||
&ListArgWithXmlNameMember.item.2=B""", | ||
bodyMediaType: "application/x-www-form-urlencoded", | ||
params: { | ||
ListArgWithXmlNameMember: ["A", "B"] | ||
} | ||
}, | ||
{ | ||
id: "QueryFlattenedListArgWithXmlName", | ||
description: "Changes the name of flattened lists using xmlName trait on the structure member", | ||
protocol: "aws.query", | ||
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: { | ||
ListArgWithXmlNameMember: ["A", "B"] | ||
} | ||
}, | ||
]) | ||
|
||
structure QueryListsInput { | ||
ListArg: StringList, | ||
ComplexListArg: GreetingList, | ||
|
||
@xmlFlattened | ||
FlattenedListArg: StringList, | ||
|
||
ListArgWithXmlNameMember: ListWithXmlName, | ||
|
||
// Notice that the xmlName on the targeted list member is ignored. | ||
@xmlFlattened | ||
@xmlName("Hi") | ||
FlattenedListArgWithXmlName: ListWithXmlName, | ||
} | ||
|
||
list ListWithXmlName { | ||
@xmlName("item") | ||
member: String | ||
} |
Oops, something went wrong.