-
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
16 changed files
with
3,150 additions
and
0 deletions.
There are no files selected for viewing
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
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,27 @@ | ||
/* | ||
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
description = "Defines protocol tests for AWS HTTP protocols." | ||
extra["displayName"] = "Smithy :: AWS :: Protocol Tests" | ||
extra["moduleName"] = "software.amazon.smithy.aws.protocoltests" | ||
|
||
plugins { | ||
id("software.amazon.smithy").version("0.4.2") | ||
} | ||
|
||
dependencies { | ||
api(project(":smithy-protocol-test-traits")) | ||
api(project(":smithy-aws-traits")) | ||
} |
255 changes: 255 additions & 0 deletions
255
smithy-aws-protocol-tests/model/rest-xml/document-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,255 @@ | ||
// This file defines test cases that serialize lists in XML documents. | ||
|
||
$version: "0.5.0" | ||
|
||
namespace aws.protocols.tests.restxml | ||
|
||
use smithy.test#httpRequestTests | ||
use smithy.test#httpResponseTests | ||
|
||
/// This test case serializes XML lists for the following cases for both | ||
/// input and output: | ||
/// | ||
/// 1. Normal XML lists. | ||
/// 2. Normal XML sets. | ||
/// 3. XML lists of lists. | ||
/// 4. XML lists with @xmlName on its members | ||
/// 5. Flattened XML lists. | ||
/// 6. Flattened XML lists with @xmlName. | ||
/// 7. Lists of structures. | ||
@idempotent | ||
@http(uri: "/XmlLists", method: "PUT") | ||
operation XmlLists(XmlListsInputOutput) -> XmlListsInputOutput | ||
|
||
apply XmlLists @httpRequestTests([ | ||
{ | ||
id: "XmlLists", | ||
description: "Serializes XML lists", | ||
protocol: "aws.rest-xml", | ||
method: "PUT", | ||
uri: "/XmlLists", | ||
body: """ | ||
<XmlListsInputOutput> | ||
<stringList> | ||
<member>foo</member> | ||
<member>bar</member> | ||
</stringList> | ||
<stringSet> | ||
<member>foo</member> | ||
<member>bar</member> | ||
</stringSet> | ||
<integerList> | ||
<member>1</member> | ||
<member>2</member> | ||
</integerList> | ||
<booleanList> | ||
<member>true</member> | ||
<member>false</member> | ||
</booleanList> | ||
<timestampList> | ||
<member>2014-04-29T18:30:38Z</member> | ||
<member>2014-04-29T18:30:38Z</member> | ||
</timestampList> | ||
<enumList> | ||
<member>Foo</member> | ||
<member>0</member> | ||
</enumList> | ||
<nestedStringList> | ||
<member> | ||
<member>foo</member> | ||
<member>bar</member> | ||
</member> | ||
<member> | ||
<member>baz</member> | ||
<member>qux</member> | ||
</member> | ||
<nestedStringList> | ||
<renamed> | ||
<item>foo</item> | ||
<item>bar</item> | ||
</renamed> | ||
<flattenedList>hi</flattenedList> | ||
<flattenedList>bye</flattenedList> | ||
<customName>yep</customName> | ||
<customName>nope</customName> | ||
<myStructureList> | ||
<item> | ||
<value>1</value> | ||
<other>2</other> | ||
</item> | ||
<item> | ||
<value>3</value> | ||
<other>4</other> | ||
</item> | ||
</myStructureList> | ||
</XmlListsInputOutput> | ||
""", | ||
bodyMediaType: "application/xml", | ||
headers: { | ||
"Content-Type": "application/xml" | ||
}, | ||
params: { | ||
stringList: ["foo", "bar"], | ||
stringSet: ["foo", "bar"], | ||
integerList: [1, 2], | ||
booleanList: [true, false], | ||
timestampList: [1398796238, 1398796238], | ||
enumList: ["Foo", "0"], | ||
nestedStringList: [["foo", "bar"], ["baz", "qux"]], | ||
renamedListMembers: ["foo", "bar"], | ||
flattenedList: ["hi", "bye"], | ||
flattenedList2: ["yep", "nope"], | ||
structureList: [ | ||
{ | ||
a: "1", | ||
b: "2", | ||
}, | ||
{ | ||
a: "3", | ||
b: "4", | ||
} | ||
] | ||
} | ||
} | ||
]) | ||
|
||
apply XmlLists @httpResponseTests([ | ||
{ | ||
id: "XmlLists", | ||
description: "Serializes XML lists", | ||
protocol: "aws.rest-xml", | ||
code: 200, | ||
body: """ | ||
<XmlListsInputOutput> | ||
<stringList> | ||
<member>foo</member> | ||
<member>bar</member> | ||
</stringList> | ||
<stringSet> | ||
<member>foo</member> | ||
<member>bar</member> | ||
</stringSet> | ||
<integerList> | ||
<member>1</member> | ||
<member>2</member> | ||
</integerList> | ||
<booleanList> | ||
<member>true</member> | ||
<member>false</member> | ||
</booleanList> | ||
<timestampList> | ||
<member>2014-04-29T18:30:38Z</member> | ||
<member>2014-04-29T18:30:38Z</member> | ||
</timestampList> | ||
<enumList> | ||
<member>Foo</member> | ||
<member>0</member> | ||
</enumList> | ||
<nestedStringList> | ||
<member> | ||
<member>foo</member> | ||
<member>bar</member> | ||
</member> | ||
<member> | ||
<member>baz</member> | ||
<member>qux</member> | ||
</member> | ||
<nestedStringList> | ||
<renamed> | ||
<item>foo</item> | ||
<item>bar</item> | ||
</renamed> | ||
<flattenedList>hi</flattenedList> | ||
<flattenedList>bye</flattenedList> | ||
<customName>yep</customName> | ||
<customName>nope</customName> | ||
<myStructureList> | ||
<item> | ||
<value>1</value> | ||
<other>2</other> | ||
</item> | ||
<item> | ||
<value>3</value> | ||
<other>4</other> | ||
</item> | ||
</myStructureList> | ||
</XmlListsInputOutput> | ||
""", | ||
bodyMediaType: "application/xml", | ||
headers: { | ||
"Content-Type": "application/xml" | ||
}, | ||
params: { | ||
stringList: ["foo", "bar"], | ||
stringSet: ["foo", "bar"], | ||
integerList: [1, 2], | ||
booleanList: [true, false], | ||
timestampList: [1398796238, 1398796238], | ||
enumList: ["Foo", "0"], | ||
nestedStringList: [["foo", "bar"], ["baz", "qux"]], | ||
renamedListMembers: ["foo", "bar"], | ||
flattenedList: ["hi", "bye"], | ||
flattenedList2: ["yep", "nope"], | ||
structureList: [ | ||
{ | ||
a: "1", | ||
b: "2", | ||
}, | ||
{ | ||
a: "3", | ||
b: "4", | ||
} | ||
] | ||
} | ||
} | ||
]) | ||
|
||
structure XmlListsInputOutput { | ||
stringList: StringList, | ||
|
||
stringSet: StringSet, | ||
|
||
integerList: IntegerList, | ||
|
||
booleanList: BooleanList, | ||
|
||
timestampList: TimestampList, | ||
|
||
enumList: FooEnumList, | ||
|
||
nestedStringList: NestedStringList, | ||
|
||
@xmlName("renamed") | ||
renamedListMembers: RenamedListMembers, | ||
|
||
@xmlFlattened | ||
// The xmlname on the targeted list is ignored, and the member name is used. | ||
flattenedList: RenamedListMembers, | ||
|
||
@xmlName("customName") | ||
@xmlFlattened | ||
// the xmlName trait on the targeted list's member is ignored when | ||
// serializing flattened lists in structures. | ||
flattenedList2: RenamedListMembers, | ||
|
||
@xmlName("myStructureList") | ||
structureList: StructureList | ||
} | ||
|
||
list RenamedListMembers { | ||
@xmlName("item") | ||
member: String, | ||
} | ||
|
||
list StructureList { | ||
@xmlName("item") | ||
member: StructureListMember, | ||
} | ||
|
||
structure StructureListMember { | ||
@xmlName("value") | ||
a: String, | ||
|
||
@xmlName("other") | ||
b: String, | ||
} |
Oops, something went wrong.