// This file defines test cases that serialize lists in XML documents. $version: "2.0" namespace aws.protocoltests.query use aws.protocols#awsQuery use aws.protocoltests.shared#BooleanList use aws.protocoltests.shared#FooEnumList use aws.protocoltests.shared#IntegerEnumList use aws.protocoltests.shared#IntegerList use aws.protocoltests.shared#NestedStringList use aws.protocoltests.shared#StringList use aws.protocoltests.shared#StringSet use aws.protocoltests.shared#TimestampList 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. operation XmlLists { output: XmlListsOutput } apply XmlLists @httpResponseTests([ { id: "QueryXmlLists", documentation: "Tests for XML list serialization", protocol: awsQuery, code: 200, body: """ foo bar foo bar 1 2 true false 2014-04-29T18:30:38Z 2014-04-29T18:30:38Z Foo 0 1 2 foo bar baz qux foo bar hi bye yep nope a b a b 1 2 3 4 """, bodyMediaType: "application/xml", headers: { "Content-Type": "text/xml" }, params: { stringList: ["foo", "bar"], stringSet: ["foo", "bar"], integerList: [1, 2], booleanList: [true, false], timestampList: [1398796238, 1398796238], enumList: ["Foo", "0"], intEnumList: [1, 2], nestedStringList: [["foo", "bar"], ["baz", "qux"]], renamedListMembers: ["foo", "bar"], flattenedList: ["hi", "bye"], flattenedList2: ["yep", "nope"], flattenedListWithMemberNamespace: ["a", "b"], flattenedListWithNamespace: ["a", "b"], structureList: [ { a: "1", b: "2", }, { a: "3", b: "4", } ] } } ]) // Operation for client only @tags(["client-only"]) operation XmlEmptyLists { output: XmlListsOutput } apply XmlEmptyLists @httpResponseTests([ { id: "QueryXmlEmptyLists", documentation: "Deserializes empty XML lists", protocol: awsQuery, code: 200, body: """ """, bodyMediaType: "application/xml", headers: { "Content-Type": "text/xml" }, params: { stringList: [], stringSet: [], }, appliesTo: "client", } ]) structure XmlListsOutput { stringList: StringList, stringSet: StringSet, integerList: IntegerList, booleanList: BooleanList, timestampList: TimestampList, enumList: FooEnumList, intEnumList: IntegerEnumList, 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, // The XML namespace of the flattened list's member is used, and // list's XML namespace is disregarded. @xmlFlattened flattenedListWithMemberNamespace: ListWithMemberNamespace, // Again, the XML namespace of the flattened list is ignored. // The namespace of the member is used, which is empty, so // no xmlns attribute appears on the serialized XML. @xmlFlattened flattenedListWithNamespace: ListWithNamespace, @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, } @xmlNamespace(uri: "https://xml-list.example.com") list ListWithMemberNamespace { @xmlNamespace(uri: "https://xml-member.example.com") member: String, } @xmlNamespace(uri: "https://xml-list.example.com") list ListWithNamespace { member: String, }