From c482c24fcf5cad4b2f8eb7e226a3f88b32a6dde8 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Thu, 9 Jan 2020 14:48:16 -0800 Subject: [PATCH] Add AWS query protocol tests --- .../model/query/empty-input-output.smithy | 115 +++++ .../model/query/input-lists.smithy | 141 ++++++ .../model/query/input-maps.smithy | 240 ++++++++++ .../model/query/input.smithy | 289 ++++++++++++ .../model/query/main.smithy | 48 ++ .../model/query/xml-errors.smithy | 139 ++++++ .../model/query/xml-lists.smithy | 169 +++++++ .../model/query/xml-maps.smithy | 211 +++++++++ .../model/query/xml-structs.smithy | 419 ++++++++++++++++++ .../model/rest-xml/document-lists.smithy | 9 + .../model/rest-xml/document-maps.smithy | 6 +- .../model/rest-xml/document-structs.smithy | 4 + .../model/rest-xml/http-headers.smithy | 9 + .../model/rest-xml/http-labels.smithy | 2 + .../model/rest-xml/http-payload.smithy | 1 + .../model/rest-xml/http-query.smithy | 9 + .../model/{rest-xml => }/shared-types.smithy | 26 +- 17 files changed, 1827 insertions(+), 10 deletions(-) create mode 100644 smithy-aws-protocol-tests/model/query/empty-input-output.smithy create mode 100644 smithy-aws-protocol-tests/model/query/input-lists.smithy create mode 100644 smithy-aws-protocol-tests/model/query/input-maps.smithy create mode 100644 smithy-aws-protocol-tests/model/query/input.smithy create mode 100644 smithy-aws-protocol-tests/model/query/main.smithy create mode 100644 smithy-aws-protocol-tests/model/query/xml-errors.smithy create mode 100644 smithy-aws-protocol-tests/model/query/xml-lists.smithy create mode 100644 smithy-aws-protocol-tests/model/query/xml-maps.smithy create mode 100644 smithy-aws-protocol-tests/model/query/xml-structs.smithy rename smithy-aws-protocol-tests/model/{rest-xml => }/shared-types.smithy (66%) diff --git a/smithy-aws-protocol-tests/model/query/empty-input-output.smithy b/smithy-aws-protocol-tests/model/query/empty-input-output.smithy new file mode 100644 index 00000000000..bb4c8d13b8c --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/empty-input-output.smithy @@ -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 {} diff --git a/smithy-aws-protocol-tests/model/query/input-lists.smithy b/smithy-aws-protocol-tests/model/query/input-lists.smithy new file mode 100644 index 00000000000..2665199a7c6 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/input-lists.smithy @@ -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 +} diff --git a/smithy-aws-protocol-tests/model/query/input-maps.smithy b/smithy-aws-protocol-tests/model/query/input-maps.smithy new file mode 100644 index 00000000000..c4a670c1a38 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/input-maps.smithy @@ -0,0 +1,240 @@ +// This file defines test cases that test map query serialization. + +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use aws.protocols.tests.shared#GreetingStruct +use aws.protocols.tests.shared#StringList +use aws.protocols.tests.shared#StringMap +use smithy.test#httpRequestTests + +/// This test serializes simple and complex maps. +operation QueryMaps(QueryMapsInput) + +apply QueryMaps @httpRequestTests([ + { + id: "QuerySimpleQueryMaps", + description: "Serializes query maps", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &MapArg.entry.1.key=foo + &MapArg.entry.1.value=Foo + &MapArg.entry.2.key=bar + &MapArg.entry.2.value=Bar""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + MapArg: { + foo: "Foo", + bar: "Bar" + } + } + }, + { + id: "QuerySimpleQueryMapsWithXmlName", + description: "Serializes query maps and uses xmlName", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &Foo.entry.1.key=foo + &Foo.entry.1.value=Foo""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + RenamedMapArg: { + foo: "Foo" + } + } + }, + { + id: "QueryComplexQueryMaps", + description: "Serializes complex query maps", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &ComplexMapArg.entry.1.key=foo + &ComplexMapArg.entry.1.value.hi=Foo + &ComplexMapArg.entry.2.key=bar + &ComplexMapArg.entry.2.value.hi=Bar""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + ComplexMapArg: { + foo: { + hi: "Foo", + }, + bar: { + hi: "Bar" + } + } + } + }, + { + id: "QueryEmptyQueryMaps", + description: "Does not serialize empty query maps", + 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: { + MapArg: {} + } + }, + { + id: "QueryQueryMapWithMemberXmlName", + description: "Serializes query maps where the member has an xmlName trait", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &MapWithXmlMemberName.entry.1.K=foo + &MapWithXmlMemberName.entry.1.V=Foo + &MapWithXmlMemberName.entry.1.K=bar + &MapWithXmlMemberName.entry.1.V=Bar""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + MapWithXmlMemberName: { + foo: "Foo", + bar: "Bar" + } + } + }, + { + id: "QueryFlattenedQueryMaps", + description: "Serializes flattened query maps", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &FlattenedMap.1.key=foo + &FlattenedMap.1.value=Foo + &FlattenedMap.1.key=bar + &FlattenedMap.1.value=Bar""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + FlattenedMap: { + foo: "Foo", + bar: "Bar" + } + } + }, + { + id: "QueryFlattenedQueryMapsWithXmlName", + description: "Serializes flattened query maps that use an xmlName", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &Hi.1.K=foo + &Hi.1.V=Foo + &Hi.2.K=bar + &Hi.2.V=Bar""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + FlattenedMapWithXmlName: { + foo: "Foo", + bar: "Bar" + } + } + }, + { + id: "QueryQueryMapOfLists", + description: "Serializes query map of lists", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryLists + &Version=2020-01-08 + &MapOfLists.entry.1.key.1=A + &MapOfLists.entry.1.key.2=B + &MapOfLists.entry.2.key.1=C + &MapOfLists.entry.2.key.2=D""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + MapOfLists: { + foo: ["A", "B"], + bar: ["C", "D"], + } + } + }, +]) + +structure QueryMapsInput { + MapArg: StringMap, + + @xmlName("Foo") + RenamedMapArg: StringMap, + + ComplexMapArg: ComplexMap, + + MapWithXmlMemberName: MapWithXmlName, + + @xmlFlattened + FlattenedMap: StringMap, + + @xmlFlattened + @xmlName("Hi") + FlattenedMapWithXmlName: MapWithXmlName, + + MapOfLists: MapOfLists, +} + +map ComplexMap { + key: String, + value: GreetingStruct, +} + +map MapWithXmlName { + @xmlName("K") + key: String, + + @xmlName("V") + value: String +} + +map MapOfLists { + key: String, + value: StringList, +} diff --git a/smithy-aws-protocol-tests/model/query/input.smithy b/smithy-aws-protocol-tests/model/query/input.smithy new file mode 100644 index 00000000000..248e40a446d --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/input.smithy @@ -0,0 +1,289 @@ +// This file defines test cases that test the basics of input serialization. + +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use aws.protocols.tests.shared#EpochSeconds +use aws.protocols.tests.shared#FooEnum +use smithy.test#httpRequestTests + +/// This test serializes strings, numbers, and boolean values. +operation SimpleInputParams(SimpleInputParamsInput) + +apply SimpleInputParams @httpRequestTests([ + { + id: "QuerySimpleInputParamsStrings", + description: "Serializes strings", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &Foo=val1 + &Bar=val2""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Foo: "val1", + Bar: "val2" + } + }, + { + id: "QuerySimpleInputParamsStringAndBooleanTrue", + description: "Serializes booleans that are true", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &Foo=val + &Baz=true""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Foo: "val1", + Baz: true, + } + }, + { + id: "QuerySimpleInputParamsStringsAndBooleanFalse", + description: "Serializes booleans that are false", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &Foo=val1 + &Baz=false""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Baz: false, + } + }, + { + id: "QuerySimpleInputParamsInteger", + description: "Serializes integers", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &Bam=10""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Bam: 10, + } + }, + { + id: "QuerySimpleInputParamsFloat", + description: "Serializes floats", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &Boo=10.8""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Boo: 10.8, + } + }, + { + id: "QuerySimpleInputParamsBlob", + description: "Blobs are base64 encoded in the query string", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &Qux=dmFsdWU%3D""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Qux: "value", + } + }, + { + id: "QueryEnums", + description: "Serializes enums in the query string", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=SimpleInputParams + &Version=2020-01-08 + &FooEnum=Foo""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + FooEnum: "Foo", + } + } +]) + +structure SimpleInputParamsInput { + Foo: String, + Bar: String, + Baz: Boolean, + Bam: Integer, + Boo: Double, + Qux: Blob, + FooEnum: FooEnum, +} + +/// This test serializes timestamps. +/// +/// 1. Timestamps are serialized as RFC 3339 date-time values by default. +/// 2. A timestampFormat trait on a member changes the format. +/// 3. A timestampFormat trait on the shape targeted by the member changes the format. +operation QueryTimestamps(QueryTimestampsInput) + +apply QueryTimestamps @httpRequestTests([ + { + id: "QueryTimestampsInput", + description: "Serializes timestamps", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=QueryTimestamps + &Version=2020-01-08 + &normalFormat=2015-01-25T08%3A00%3A00Z + &epochMember=1422172800 + &epochTarget=1422172800""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + normalFormat: 1422172800, + epochMember: 1422172800, + epochTarget: 1422172800, + } + } +]) + +structure QueryTimestampsInput { + // Timestamps are serialized as RFC 3339 date-time values by default. + normalFormat: Timestamp, + + // This member has the timestampFormat trait, so it changes the + // timestamp serialization. + @timestampFormat("epoch-seconds") + epochMember: Timestamp, + + // The targeted shape has the timestampFormat trait, so it changes the + // timestamp serialization. + epochTarget: EpochSeconds, +} + +/// This test serializes nested and recursive structure members. +operation NestedStructures(NestedStructuresInput) + +apply NestedStructures @httpRequestTests([ + { + id: "NestedStructures", + description: "Serializes nested structures using dots", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=NestedStructures + &Version=2020-01-08 + &Nested.StringArg=foo + &Nested.OtherArg=true + &Nested.RecursiveArg.StringArg=baz""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + Nested: { + StringArg: "foo", + OtherArg: true, + RecursiveArg: { + StringArg: "baz" + } + } + } + } +]) + +structure NestedStructuresInput { + Nested: StructArg, +} + +structure StructArg { + StringArg: String, + OtherArg: Boolean, + RecursiveArg: StructArg, +} + +/// Automatically adds idempotency tokens. +@tags(["client-only"]) +operation QueryIdempotencyTokenAutoFill(QueryIdempotencyTokenAutoFillInput) + +apply QueryIdempotencyTokenAutoFill @httpRequestTests([ + { + id: "QueryProtocolIdempotencyTokenAutoFill", + description: "Automatically adds idempotency token when not set", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=NestedStructures + &Version=2020-01-08 + &token=00000000-0000-4000-8000-000000000000""", + bodyMediaType: "application/x-www-form-urlencoded", + }, + { + id: "QueryProtocolIdempotencyTokenAutoFillIsSet", + description: "Uses the given idempotency token as-is", + protocol: "aws.query", + method: "POST", + uri: "/", + headers: { + "Content-Type": "application/x-www-form-urlencoded" + }, + body: """ + Action=NestedStructures + &Version=2020-01-08 + &token=00000000-0000-4000-8000-000000000123""", + bodyMediaType: "application/x-www-form-urlencoded", + params: { + token: "00000000-0000-4000-8000-000000000123" + } + } +]) + +structure QueryIdempotencyTokenAutoFillInput { + @idempotencyToken + token: String, +} diff --git a/smithy-aws-protocol-tests/model/query/main.smithy b/smithy-aws-protocol-tests/model/query/main.smithy new file mode 100644 index 00000000000..32dfef0b5a0 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/main.smithy @@ -0,0 +1,48 @@ +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use smithy.test#httpRequestTests +use smithy.test#httpResponseTests + +/// A query service that sends query requests and XML responses. +@protocols([{"name": "aws.query"}]) +@xmlNamespace(uri: "https://example.com/") +service AwsQuery { + version: "2020-01-08", + operations: [ + // Basic input and output tests + NoInputAndNoOutput, + NoInputAndOutput, + EmptyInputAndEmptyOutput, + + // Input tests + SimpleInputParams, + QueryTimestamps, + NestedStructures, + QueryLists, + QueryMaps, + QueryIdempotencyTokenAutoFill, + + // Output XML map tests + XmlMaps, + XmlMapsXmlName, + FlattenedXmlMap, + FlattenedXmlMapWithXmlName, + + // Output XML list tests + XmlLists, + + // Output XML structure tests + SimpleScalarXmlProperties, + XmlBlobs, + XmlTimestamps, + XmlEnums, + RecursiveXmlShapes, + RecursiveXmlShapes, + IgnoresWrappingXmlName, + + // Output error tests + GreetingWithErrors, + ] +} diff --git a/smithy-aws-protocol-tests/model/query/xml-errors.smithy b/smithy-aws-protocol-tests/model/query/xml-errors.smithy new file mode 100644 index 00000000000..5be364ecfc9 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/xml-errors.smithy @@ -0,0 +1,139 @@ +// This file defines test cases that serialize lists in XML documents. +// +// AWS/QUERY serialzies errors using the following format: +// +// +// +// +// Sender +// +// InvalidParameterValue +// +// The message contents +// +// +// +// 42d59b56-7407-4c4a-be0f-4c88daeea257 +// +// +// The wrapping element name is always "ErrorResponse". It always contains a nested +// element named "Error" that is the error structure contents plus other key value +// pairs. "ErrorResponse" always has a sibling element named "RequestId" that can +// be used to identify the request that caused the failure. +// +// See: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-api-responses.html#sqs-api-error-response-structure + +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use smithy.test#httpResponseTests + +/// This operation has three possible return values: +/// +/// 1. A successful response in the form of GreetingWithErrorsOutput +/// 2. An InvalidGreeting error. +/// 3. A BadRequest error. +operation GreetingWithErrors() -> GreetingWithErrorsOutput errors [InvalidGreeting, ComplexError] + +apply GreetingWithErrors @httpResponseTests([ + { + id: "QueryGreetingWithErrors", + description: "Ensures that operations with errors successfully know how to deserialize the successful response", + protocol: "aws.query", + code: 200, + body: """ + + + Hello + + + """, + headers: { + "Content-Type": "text/xml" + }, + params: { + greeting: "Hello" + } + } +]) + +structure GreetingWithErrorsOutput { + greeting: String, +} + +/// This error is thrown when an invalid greeting value is provided. +@error("client") +structure InvalidGreeting { + Message: String, +} + +apply InvalidGreeting @httpResponseTests([ + { + id: "QueryInvalidGreetingError", + description: "Parses simple XML errors", + protocol: "aws.query", + params: { + Message: "Hi" + }, + code: 400, + headers: { + "Content-Type": "text/xml" + }, + body: """ + + + Sender + InvalidGreeting + Hi + + foo-id + + """, + bodyMediaType: "application/xml", + } +]) + +/// This error is thrown when a request is invalid. +@error("client") +structure ComplexError { + TopLevel: String, + + Nested: ComplexNestedErrorData, +} + +apply ComplexError @httpResponseTests([ + { + id: "QueryComplexError", + protocol: "aws.query", + params: { + TopLevel: "Top level", + Nested: { + Foo: "bar" + } + }, + code: 400, + headers: { + "Content-Type": "text/xml" + }, + body: """ + + + Sender + ComplexError + Hi + Top level + + bar + + + foo-id + + """, + bodyMediaType: "application/xml", + } +]) + +structure ComplexNestedErrorData { + Foo: String, +} diff --git a/smithy-aws-protocol-tests/model/query/xml-lists.smithy b/smithy-aws-protocol-tests/model/query/xml-lists.smithy new file mode 100644 index 00000000000..16c5c624f61 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/xml-lists.smithy @@ -0,0 +1,169 @@ +// This file defines test cases that serialize lists in XML documents. + +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use aws.protocols.tests.shared#BooleanList +use aws.protocols.tests.shared#FooEnumList +use aws.protocols.tests.shared#IntegerList +use aws.protocols.tests.shared#NestedStringList +use aws.protocols.tests.shared#StringList +use aws.protocols.tests.shared#StringSet +use aws.protocols.tests.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() -> XmlListsOutput + +apply XmlLists @httpResponseTests([ + { + id: "QueryXmlLists", + description: "Serializes XML lists", + protocol: "aws.query", + code: 200, + body: """ + + + + foo + bar + + + foo + bar + + + 1 + 2 + + + true + false + + + 2014-04-29T18:30:38Z + 2014-04-29T18:30:38Z + + + Foo + 0 + + + + foo + bar + + + baz + qux + + + + foo + bar + + hi + bye + yep + nope + + + 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"], + nestedStringList: [["foo", "bar"], ["baz", "qux"]], + renamedListMembers: ["foo", "bar"], + flattenedList: ["hi", "bye"], + flattenedList2: ["yep", "nope"], + structureList: [ + { + a: "1", + b: "2", + }, + { + a: "3", + b: "4", + } + ] + } + } +]) + +structure XmlListsOutput { + 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, +} diff --git a/smithy-aws-protocol-tests/model/query/xml-maps.smithy b/smithy-aws-protocol-tests/model/query/xml-maps.smithy new file mode 100644 index 00000000000..de144af7639 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/xml-maps.smithy @@ -0,0 +1,211 @@ +// This file defines test cases that serialize maps in XML payloads. + +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use aws.protocols.tests.shared#FooEnumMap +use aws.protocols.tests.shared#GreetingStruct +use smithy.test#httpResponseTests + +/// The example tests basic map serialization. +operation XmlMaps() -> XmlMapsOutput + +apply XmlMaps @httpResponseTests([ + { + id: "QueryXmlMaps", + description: "Serializes XML maps", + protocol: "aws.query", + code: 200, + body: """ + + + + + foo + + there + + + + baz + + bye + + + + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + myMap: { + foo: { + hi: "there" + }, + baz: { + hi: "bye" + } + } + } + } +]) + +structure XmlMapsOutput { + myMap: XmlMapsOutputMap, +} + +map XmlMapsOutputMap { + key: String, + value: GreetingStruct +} + +// This example tests maps with @xmlName on members. +operation XmlMapsXmlName() -> XmlMapsXmlNameOutput + +apply XmlMapsXmlName @httpResponseTests([ + { + id: "QueryQueryXmlMapsXmlName", + description: "Serializes XML lists", + protocol: "aws.query", + code: 200, + body: """ + + + + + foo + + there + + + + baz + + bye + + + + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + myMap: { + foo: { + hi: "there" + }, + baz: { + hi: "bye" + } + } + } + } +]) + +structure XmlMapsXmlNameOutput { + myMap: XmlMapsXmlNameOutputMap, +} + +map XmlMapsXmlNameOutputMap { + @xmlName("Attribute") + key: String, + + @xmlName("Setting") + value: GreetingStruct +} + +/// Flattened maps +operation FlattenedXmlMap() -> FlattenedXmlMapOutput + +apply FlattenedXmlMap @httpResponseTests([ + { + id: "QueryQueryFlattenedXmlMap", + description: "Serializes flattened XML maps in responses", + protocol: "aws.query", + code: 200, + body: """ + + + + foo + Foo + + + baz + Baz + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + myMap: { + foo: "Foo", + baz: "Baz" + } + } + } +]) + +structure FlattenedXmlMapOutput { + @xmlFlattened + myMap: FooEnumMap, +} + +/// Flattened maps with @xmlName +operation FlattenedXmlMapWithXmlName() -> FlattenedXmlMapWithXmlNameOutput + +apply FlattenedXmlMapWithXmlName @httpResponseTests([ + { + id: "QueryQueryFlattenedXmlMapWithXmlName", + description: "Serializes flattened XML maps in responses that have xmlName on members", + protocol: "aws.query", + code: 200, + body: """ + + + + a + A + + + b + B + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + myMap: { + a: "A", + b: "B", + } + } + } +]) + +structure FlattenedXmlMapWithXmlNameOutput { + @xmlFlattened + @xmlName("KVP") + myMap: FlattenedXmlMapWithXmlNameOutputMap, +} + +map FlattenedXmlMapWithXmlNameOutputMap { + @xmlName("K") + key: String, + + @xmlName("V") + value: String, +} diff --git a/smithy-aws-protocol-tests/model/query/xml-structs.smithy b/smithy-aws-protocol-tests/model/query/xml-structs.smithy new file mode 100644 index 00000000000..f5d93ffa884 --- /dev/null +++ b/smithy-aws-protocol-tests/model/query/xml-structs.smithy @@ -0,0 +1,419 @@ +// This file defines test cases that serialize synthesized XML documents +// in the payload of HTTP requests and responses. + +$version: "0.5.0" + +namespace aws.protocols.tests.query + +use aws.protocols.tests.shared#FooEnum +use aws.protocols.tests.shared#FooEnumList +use aws.protocols.tests.shared#FooEnumSet +use aws.protocols.tests.shared#FooEnumMap +use smithy.test#httpResponseTests + +// This example serializes simple scalar types in the top level XML document. +// Note that headers are not serialized in the payload. +operation SimpleScalarXmlProperties() -> SimpleScalarXmlPropertiesOutput + +apply SimpleScalarXmlProperties @httpResponseTests([ + { + id: "QuerySimpleScalarProperties", + description: "Serializes simple scalar properties", + protocol: "aws.query", + code: 200, + body: """ + + + string + true + false + 1 + 2 + 3 + 4 + 5.5 + 6.5 + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + stringValue: "string", + trueBooleanValue: true, + falseBooleanValue: false, + byteValue: 1, + shortValue: 2, + integerValue: 3, + longValue: 4, + floatValue: 5.5, + doubleValue: 6.5, + } + } +]) + +structure SimpleScalarXmlPropertiesOutput { + stringValue: String, + trueBooleanValue: Boolean, + falseBooleanValue: Boolean, + byteValue: Byte, + shortValue: Short, + integerValue: Integer, + longValue: Long, + floatValue: Float, + + @xmlName("DoubleDribble") + doubleValue: Double, +} + +/// Blobs are base64 encoded +operation XmlBlobs() -> XmlBlobsOutput + +apply XmlBlobs @httpResponseTests([ + { + id: "QueryXmlBlobs", + description: "Blobs are base64 encoded", + protocol: "aws.query", + code: 200, + body: """ + + + dmFsdWU= + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + data: "value" + } + } +]) + +structure XmlBlobsOutput { + data: Blob +} + +/// This tests how timestamps are serialized, including using the +/// default format of date-time and various @timestampFormat trait +/// values. +operation XmlTimestamps() -> XmlTimestampsOutput + +apply XmlTimestamps @httpResponseTests([ + { + id: "QueryXmlTimestamps", + description: "Tests how normal timestamps are serialized", + protocol: "aws.query", + code: 200, + body: """ + + + 2014-04-29T18:30:38Z + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + normal: 1398796238 + } + }, + { + id: "QueryXmlTimestampsWithDateTimeFormat", + description: "Ensures that the timestampFormat of date-time works like normal timestamps", + protocol: "aws.query", + code: 200, + body: """ + + + 2014-04-29T18:30:38Z + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + dateTime: 1398796238 + } + }, + { + id: "QueryXmlTimestampsWithEpochSecondsFormat", + description: "Ensures that the timestampFormat of epoch-seconds works", + protocol: "aws.query", + code: 200, + body: """ + + + 1398796238 + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + epochSeconds: 1398796238 + } + }, + { + id: "QueryXmlTimestampsWithHttpDateFormat", + description: "Ensures that the timestampFormat of http-date works", + protocol: "aws.query", + code: 200, + body: """ + + + Tue, 29 Apr 2014 18:30:38 GMT + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + httpDate: 1398796238 + } + }, +]) + +structure XmlTimestampsOutput { + normal: Timestamp, + + @timestampFormat("date-time") + dateTime: Timestamp, + + @timestampFormat("epoch-seconds") + epochSeconds: Timestamp, + + @timestampFormat("http-date") + httpDate: Timestamp, +} + +/// This example serializes enums as top level properties, in lists, sets, and maps. +operation XmlEnums() -> XmlEnumsOutput + +apply XmlEnums @httpResponseTests([ + { + id: "QueryXmlEnums", + description: "Serializes simple scalar properties", + protocol: "aws.query", + code: 200, + body: """ + + + Foo + 0 + 1 + + Foo + 0 + + + Foo + 0 + + + + hi + Foo + + + zero + 0 + + + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + fooEnum1: "Foo", + fooEnum2: "0", + fooEnum3: "1", + fooEnumList: ["Foo", "0"], + fooEnumSet: ["Foo", "0"], + fooEnumMap: { + "hi": "Foo", + "zero": "0" + } + } + } +]) + +structure XmlEnumsOutput { + fooEnum1: FooEnum, + fooEnum2: FooEnum, + fooEnum3: FooEnum, + fooEnumList: FooEnumList, + fooEnumSet: FooEnumSet, + fooEnumMap: FooEnumMap, +} + +/// Recursive shapes +operation RecursiveXmlShapes() -> RecursiveXmlShapesOutput + +apply RecursiveXmlShapes @httpResponseTests([ + { + id: "QueryRecursiveShapes", + description: "Serializes recursive structures", + protocol: "aws.query", + code: 200, + body: """ + + + + Foo1 + + Bar1 + + Foo2 + + Bar2 + + + + + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + nested: { + foo: "Foo1", + nested: { + bar: "Bar1", + recursiveMember: { + foo: "Foo2", + nested: { + bar: "Bar2" + } + } + } + } + } + } +]) + +structure RecursiveXmlShapesOutput { + nested: RecursiveXmlShapesOutputNested1 +} + +structure RecursiveXmlShapesOutputNested1 { + foo: String, + nested: RecursiveXmlShapesOutputNested2 +} + +structure RecursiveXmlShapesOutputNested2 { + bar: String, + recursiveMember: RecursiveXmlShapesOutputNested1, +} + +// XML namespace +operation XmlNamespaces() -> XmlNamespacesOutput + +apply XmlNamespaces @httpResponseTests([ + { + id: "QueryXmlNamespaces", + description: "Serializes XML namespaces", + protocol: "aws.query", + code: 200, + body: """ + + + + Foo + + Bar + Baz + + + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + nested: { + foo: "Foo", + values: [ + "Bar", + "Baz" + ] + } + } + } +]) + +// The xmlNamespace trait is *ignored* on the outer structure when using AWS Query. +// It only honors the xmlNamespace set on the service shape. +@xmlNamespace(uri: "http://foo.com") +structure XmlNamespacesOutput { + nested: XmlNamespaceNested +} + +// Ingored since it's not at the top-level +@xmlNamespace(uri: "http://foo.com") +structure XmlNamespaceNested { + @xmlNamespace(uri: "http://baz.com", prefix: "baz") + foo: String, + + @xmlNamespace(uri: "http://qux.com") + values: XmlNamespacedList +} + +list XmlNamespacedList { + @xmlNamespace(uri: "http://bux.com") + member: String, +} + +/// The xmlName trait on the output structure is ignored in AWS Query. +/// +/// The wrapping element is always operation name + "Response", and +/// inside of that wrapper is another wrapper named operation name + "Result". +operation IgnoresWrappingXmlName() -> IgnoresWrappingXmlNameOutput + +apply IgnoresWrappingXmlName @httpResponseTests([ + { + id: "QueryIgnoresWrappingXmlName", + description: "The xmlName trait on the output structure is ignored in AWS Query", + protocol: "aws.query", + code: 200, + body: """ + + + bar + + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "text/xml" + }, + params: { + foo: "bar" + } + } +]) + +@xmlName("IgnoreMe") +structure IgnoresWrappingXmlNameOutput { + foo: String +} diff --git a/smithy-aws-protocol-tests/model/rest-xml/document-lists.smithy b/smithy-aws-protocol-tests/model/rest-xml/document-lists.smithy index 8c8cbb7a160..b678982786d 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/document-lists.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/document-lists.smithy @@ -4,6 +4,15 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#BooleanList +use aws.protocols.tests.shared#EpochSeconds +use aws.protocols.tests.shared#FooEnumList +use aws.protocols.tests.shared#GreetingList +use aws.protocols.tests.shared#IntegerList +use aws.protocols.tests.shared#NestedStringList +use aws.protocols.tests.shared#StringList +use aws.protocols.tests.shared#StringSet +use aws.protocols.tests.shared#TimestampList use smithy.test#httpRequestTests use smithy.test#httpResponseTests diff --git a/smithy-aws-protocol-tests/model/rest-xml/document-maps.smithy b/smithy-aws-protocol-tests/model/rest-xml/document-maps.smithy index eb395efce8f..d40d0b94d05 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/document-maps.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/document-maps.smithy @@ -4,6 +4,8 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#FooEnumMap +use aws.protocols.tests.shared#GreetingStruct use smithy.test#httpRequestTests use smithy.test#httpResponseTests @@ -103,10 +105,6 @@ map XmlMapsInputOutputMap { value: GreetingStruct } -structure GreetingStruct { - hi: String -} - // This example tests maps with @xmlName on members. @http(uri: "/XmlMapsXmlName", method: "POST") operation XmlMapsXmlName(XmlMapsXmlNameInputOutput) -> XmlMapsXmlNameInputOutput diff --git a/smithy-aws-protocol-tests/model/rest-xml/document-structs.smithy b/smithy-aws-protocol-tests/model/rest-xml/document-structs.smithy index d7eeb6298c5..a8b7e772bea 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/document-structs.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/document-structs.smithy @@ -5,6 +5,10 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#FooEnum +use aws.protocols.tests.shared#FooEnumList +use aws.protocols.tests.shared#FooEnumSet +use aws.protocols.tests.shared#FooEnumMap use smithy.test#httpRequestTests use smithy.test#httpResponseTests diff --git a/smithy-aws-protocol-tests/model/rest-xml/http-headers.smithy b/smithy-aws-protocol-tests/model/rest-xml/http-headers.smithy index 23f5e6921c6..414e4eef8b6 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/http-headers.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/http-headers.smithy @@ -5,6 +5,15 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#BooleanList +use aws.protocols.tests.shared#EpochSeconds +use aws.protocols.tests.shared#FooEnum +use aws.protocols.tests.shared#FooEnumList +use aws.protocols.tests.shared#HttpDate +use aws.protocols.tests.shared#IntegerList +use aws.protocols.tests.shared#StringList +use aws.protocols.tests.shared#StringSet +use aws.protocols.tests.shared#TimestampList use smithy.test#httpRequestTests use smithy.test#httpResponseTests diff --git a/smithy-aws-protocol-tests/model/rest-xml/http-labels.smithy b/smithy-aws-protocol-tests/model/rest-xml/http-labels.smithy index 352b0ac8358..203a1e75ce0 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/http-labels.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/http-labels.smithy @@ -5,6 +5,8 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#EpochSeconds +use aws.protocols.tests.shared#HttpDate use smithy.test#httpRequestTests use smithy.test#httpResponseTests diff --git a/smithy-aws-protocol-tests/model/rest-xml/http-payload.smithy b/smithy-aws-protocol-tests/model/rest-xml/http-payload.smithy index 15e82c25942..5372d6b0735 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/http-payload.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/http-payload.smithy @@ -5,6 +5,7 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#TextPlainBlob use smithy.test#httpRequestTests use smithy.test#httpResponseTests diff --git a/smithy-aws-protocol-tests/model/rest-xml/http-query.smithy b/smithy-aws-protocol-tests/model/rest-xml/http-query.smithy index 7f59a145754..e7cea5a5946 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/http-query.smithy +++ b/smithy-aws-protocol-tests/model/rest-xml/http-query.smithy @@ -5,6 +5,15 @@ $version: "0.5.0" namespace aws.protocols.tests.restxml +use aws.protocols.tests.shared#BooleanList +use aws.protocols.tests.shared#DoubleList +use aws.protocols.tests.shared#FooEnum +use aws.protocols.tests.shared#FooEnumList +use aws.protocols.tests.shared#IntegerList +use aws.protocols.tests.shared#IntegerSet +use aws.protocols.tests.shared#StringList +use aws.protocols.tests.shared#StringSet +use aws.protocols.tests.shared#TimestampList use smithy.test#httpRequestTests use smithy.test#httpResponseTests diff --git a/smithy-aws-protocol-tests/model/rest-xml/shared-types.smithy b/smithy-aws-protocol-tests/model/shared-types.smithy similarity index 66% rename from smithy-aws-protocol-tests/model/rest-xml/shared-types.smithy rename to smithy-aws-protocol-tests/model/shared-types.smithy index 2b227276881..9d5d2129a01 100644 --- a/smithy-aws-protocol-tests/model/rest-xml/shared-types.smithy +++ b/smithy-aws-protocol-tests/model/shared-types.smithy @@ -1,12 +1,13 @@ -// This file contains shared types that are used throughout the rest-xml -// test cases. Anything that is generic enough that it could potentially -// be reused should be defined in this file. However, things like input -// or output structures or other test-case specific shapes should be -// defined closer to the test case and in its same file. +// This file contains shared types that are used throughout the test cases. +// +// Anything that is generic enough that it could potentially be reused +// should be defined in this file. However, things like input or output +// structures or other test-case specific shapes should be defined closer to +// the test case and in its same file. $version: "0.5.0" -namespace aws.protocols.tests.restxml +namespace aws.protocols.tests.shared list StringList { member: String, @@ -16,6 +17,11 @@ set StringSet { member: String, } +map StringMap { + key: String, + value: String, +} + /// A list of lists of strings. list NestedStringList { member: StringList, @@ -74,3 +80,11 @@ timestamp HttpDate @mediaType("text/plain") blob TextPlainBlob + +structure GreetingStruct { + hi: String, +} + +list GreetingList { + member: GreetingStruct +}