Update protocol tests with int enum coverage (#1492)

* Add coverage for `intEnum` in all protocol tests

As part of IDL 2.0, the `intEnum` shape was added. The following changes
add several test cases using an `intEnum` shape (and/or aggregates)
under the `awsJson1_*`, *Query, and `RestXml` protocol test suites.
This commit is contained in:
Hayden Baker 2022-11-14 10:38:13 -08:00 committed by GitHub
parent 33fe7b1e64
commit c226a57ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 676 additions and 0 deletions

View File

@ -11,6 +11,7 @@ use aws.protocoltests.shared#StringList
use aws.protocoltests.shared#StringMap
use aws.protocoltests.shared#GreetingStruct
use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#IntegerEnum
/// This operation uses unions for inputs and outputs.
@ -38,6 +39,7 @@ union MyUnion {
blobValue: Blob,
timestampValue: Timestamp,
enumValue: FooEnum,
intEnumValue: IntegerEnum,
listValue: StringList,
mapValue: StringMap,
structureValue: GreetingStruct,
@ -182,6 +184,29 @@ apply JsonUnions @httpRequestTests([
}
}
},
{
id: "AwsJson10SerializeIntEnumUnionValue",
documentation: "Serializes an intEnum union value",
protocol: awsJson1_0,
method: "POST",
"uri": "/",
body: """
{
"contents": {
"intEnumValue": 1
}
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/x-amz-json-1.0",
"X-Amz-Target": "JsonRpc10.JsonUnions",
},
params: {
contents: {
intEnumValue: 1
}
}
},
{
id: "AwsJson10SerializeListUnionValue",
documentation: "Serializes a list union value",
@ -390,6 +415,27 @@ apply JsonUnions @httpResponseTests([
}
}
},
{
id: "AwsJson10DeserializeIntEnumUnionValue",
documentation: "Deserializes an intEnum union value",
protocol: awsJson1_0,
code: 200,
body: """
{
"contents": {
"intEnumValue": 1
}
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/x-amz-json-1.0",
},
params: {
contents: {
intEnumValue: 1
}
}
},
{
id: "AwsJson10DeserializeListUnionValue",
documentation: "Deserializes a list union value",

View File

@ -7,6 +7,10 @@ use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#FooEnumSet
use aws.protocoltests.shared#FooEnumMap
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerEnumSet
use aws.protocoltests.shared#IntegerEnumMap
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests
@ -109,3 +113,106 @@ structure JsonEnumsInputOutput {
fooEnumSet: FooEnumSet,
fooEnumMap: FooEnumMap,
}
/// This example serializes intEnums as top level properties, in lists, sets, and maps.
@idempotent
operation JsonIntEnums {
input: JsonIntEnumsInputOutput,
output: JsonIntEnumsInputOutput
}
apply JsonIntEnums @httpRequestTests([
{
id: "AwsJson11IntEnums",
documentation: "Serializes simple scalar properties",
protocol: awsJson1_1,
method: "POST",
uri: "/",
body: """
{
"intEnum1": 1,
"intEnum2": 2,
"intEnum3": 3,
"intEnumList": [
1,
2
],
"intEnumSet": [
1,
2
],
"intEnumMap": {
"a": 1,
"b": 2
}
}""",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.JsonIntEnums",
},
bodyMediaType: "application/json",
params: {
intEnum1: 1,
intEnum2: 2,
intEnum3: 3,
intEnumList: [1, 2],
intEnumSet: [1, 2],
intEnumMap: {
"a": 1,
"b": 2
}
}
}
])
apply JsonIntEnums @httpResponseTests([
{
id: "AwsJson11IntEnums",
documentation: "Serializes simple scalar properties",
protocol: awsJson1_1,
code: 200,
body: """
{
"intEnum1": 1,
"intEnum2": 2,
"intEnum3": 3,
"intEnumList": [
1,
2
],
"intEnumSet": [
1,
2
],
"intEnumMap": {
"a": 1,
"b": 2
}
}""",
headers: {
"Content-Type": "application/x-amz-json-1.1",
"X-Amz-Target": "JsonProtocol.JsonIntEnums",
},
bodyMediaType: "application/json",
params: {
intEnum1: 1,
intEnum2: 2,
intEnum3: 3,
intEnumList: [1, 2],
intEnumSet: [1, 2],
intEnumMap: {
"a": 1,
"b": 2
}
}
}
])
structure JsonIntEnumsInputOutput {
intEnum1: IntegerEnum,
intEnum2: IntegerEnum,
intEnum3: IntegerEnum,
intEnumList: IntegerEnumList,
intEnumSet: IntegerEnumSet,
intEnumMap: IntegerEnumMap,
}

View File

@ -7,6 +7,7 @@ namespace aws.protocoltests.query
use aws.protocols#awsQuery
use aws.protocoltests.shared#EpochSeconds
use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#IntegerEnum
use smithy.test#httpRequestTests
/// This test serializes strings, numbers, and boolean values.
@ -143,6 +144,24 @@ apply SimpleInputParams @httpRequestTests([
FooEnum: "Foo",
}
},
{
id: "QueryIntEnums",
documentation: "Serializes intEnums in the query string",
protocol: awsQuery,
method: "POST",
uri: "/",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: "Action=SimpleInputParams&Version=2020-01-08&IntegerEnum=1",
bodyMediaType: "application/x-www-form-urlencoded",
params: {
IntegerEnum: 1,
}
},
{
id: "AwsQuerySupportsNaNFloatInputs",
documentation: "Supports handling NaN float values.",
@ -211,6 +230,7 @@ structure SimpleInputParamsInput {
Boo: Double,
Qux: Blob,
FooEnum: FooEnum,
IntegerEnum: IntegerEnum
}
/// This test serializes timestamps.

View File

@ -47,6 +47,7 @@ service AwsQuery {
XmlBlobs,
XmlTimestamps,
XmlEnums,
XmlIntEnums,
RecursiveXmlShapes,
RecursiveXmlShapes,
IgnoresWrappingXmlName,

View File

@ -7,6 +7,7 @@ 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
@ -61,6 +62,10 @@ apply XmlLists @httpResponseTests([
<member>Foo</member>
<member>0</member>
</enumList>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<nestedStringList>
<member>
<member>foo</member>
@ -107,6 +112,7 @@ apply XmlLists @httpResponseTests([
booleanList: [true, false],
timestampList: [1398796238, 1398796238],
enumList: ["Foo", "0"],
intEnumList: [1, 2],
nestedStringList: [["foo", "bar"], ["baz", "qux"]],
renamedListMembers: ["foo", "bar"],
flattenedList: ["hi", "bye"],
@ -172,6 +178,8 @@ structure XmlListsOutput {
enumList: FooEnumList,
intEnumList: IntegerEnumList,
nestedStringList: NestedStringList,
@xmlName("renamed")

View File

@ -11,6 +11,10 @@ use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#FooEnumSet
use aws.protocoltests.shared#FooEnumMap
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerEnumSet
use aws.protocoltests.shared#IntegerEnumMap
use aws.protocoltests.shared#HttpDate
use smithy.test#httpResponseTests
@ -459,6 +463,71 @@ structure XmlEnumsOutput {
fooEnumMap: FooEnumMap,
}
/// This example serializes enums as top level properties, in lists, sets, and maps.
operation XmlIntEnums {
output: XmlIntEnumsOutput
}
apply XmlIntEnums @httpResponseTests([
{
id: "QueryXmlIntEnums",
documentation: "Serializes simple scalar properties",
protocol: awsQuery,
code: 200,
body: """
<XmlIntEnumsResponse xmlns="https://example.com/">
<XmlIntEnumsResult>
<intEnum1>1</intEnum1>
<intEnum2>2</intEnum2>
<intEnum3>3</intEnum3>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<intEnumSet>
<member>1</member>
<member>2</member>
</intEnumSet>
<intEnumMap>
<entry>
<key>a</key>
<value>1</value>
</entry>
<entry>
<key>b</key>
<value>2</value>
</entry>
</intEnumMap>
</XmlIntEnumsResult>
</XmlIntEnumsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml"
},
params: {
intEnum1: 1,
intEnum2: 2,
intEnum3: 3,
intEnumList: [1, 2],
intEnumSet: [1, 2],
intEnumMap: {
"a": 1,
"b": 2
}
}
}
])
structure XmlIntEnumsOutput {
intEnum1: IntegerEnum,
intEnum2: IntegerEnum,
intEnum3: IntegerEnum,
intEnumList: IntegerEnumList,
intEnumSet: IntegerEnumSet,
intEnumMap: IntegerEnumMap,
}
/// Recursive shapes
operation RecursiveXmlShapes {
output: RecursiveXmlShapesOutput

View File

@ -63,6 +63,7 @@ service AwsEc2 {
XmlBlobs,
XmlTimestamps,
XmlEnums,
XmlIntEnums,
RecursiveXmlShapes,
RecursiveXmlShapes,
IgnoresWrappingXmlName,

View File

@ -7,6 +7,7 @@ namespace aws.protocoltests.ec2
use aws.protocols#ec2Query
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
@ -61,6 +62,10 @@ apply XmlLists @httpResponseTests([
<member>Foo</member>
<member>0</member>
</enumList>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<nestedStringList>
<member>
<member>foo</member>
@ -107,6 +112,7 @@ apply XmlLists @httpResponseTests([
booleanList: [true, false],
timestampList: [1398796238, 1398796238],
enumList: ["Foo", "0"],
intEnumList: [1, 2],
nestedStringList: [["foo", "bar"], ["baz", "qux"]],
renamedListMembers: ["foo", "bar"],
flattenedList: ["hi", "bye"],
@ -170,6 +176,8 @@ structure XmlListsOutput {
enumList: FooEnumList,
intEnumList :IntegerEnumList,
nestedStringList: NestedStringList,
@xmlName("renamed")

View File

@ -12,6 +12,10 @@ use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#FooEnumSet
use aws.protocoltests.shared#FooEnumMap
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerEnumSet
use aws.protocoltests.shared#IntegerEnumMap
use aws.protocoltests.shared#HttpDate
use smithy.test#httpResponseTests
@ -445,6 +449,70 @@ structure XmlEnumsOutput {
fooEnumMap: FooEnumMap,
}
/// This example serializes intEnums as top level properties, in lists, sets, and maps.
operation XmlIntEnums {
output: XmlIntEnumsOutput
}
apply XmlIntEnums @httpResponseTests([
{
id: "Ec2XmlIntEnums",
documentation: "Serializes simple scalar properties",
protocol: ec2Query,
code: 200,
body: """
<XmlIntEnumsResponse xmlns="https://example.com/">
<intEnum1>1</intEnum1>
<intEnum2>2</intEnum2>
<intEnum3>3</intEnum3>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<intEnumSet>
<member>1</member>
<member>2</member>
</intEnumSet>
<intEnumMap>
<entry>
<key>a</key>
<value>1</value>
</entry>
<entry>
<key>b</key>
<value>2</value>
</entry>
</intEnumMap>
<RequestId>requestid</RequestId>
</XmlIntEnumsResponse>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "text/xml;charset=UTF-8"
},
params: {
intEnum1: 1,
intEnum2: 2,
intEnum3: 3,
intEnumList: [1, 2],
intEnumSet: [1, 2],
intEnumMap: {
"a": 1,
"b": 2
}
}
}
])
structure XmlIntEnumsOutput {
intEnum1: IntegerEnum,
intEnum2: IntegerEnum,
intEnum3: IntegerEnum,
intEnumList: IntegerEnumList,
intEnumSet: IntegerEnumSet,
intEnumMap: IntegerEnumMap,
}
/// Recursive shapes
operation RecursiveXmlShapes {
output: RecursiveXmlShapesOutput

View File

@ -11,6 +11,8 @@ use aws.protocoltests.shared#DateTime
use aws.protocoltests.shared#EpochSeconds
use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#HttpDate
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#StringList
@ -134,6 +136,23 @@ apply InputAndOutputWithHeaders @httpRequestTests([
headerEnumList: ["Foo", "Bar", "Baz"],
}
},
{
id: "RestJsonInputAndOutputWithIntEnumHeaders",
documentation: "Tests requests with intEnum header bindings",
protocol: restJson1,
method: "POST",
uri: "/InputAndOutputWithHeaders",
headers: {
"X-IntegerEnum": "1",
"X-IntegerEnumList": "1, 2, 3"
},
body: "",
params: {
headerIntegerEnum: 1,
headerIntegerEnumList: [1, 2, 3],
}
},
{
id: "RestJsonSupportsNaNFloatHeaderInputs",
documentation: "Supports handling NaN float header values.",
@ -279,6 +298,20 @@ apply InputAndOutputWithHeaders @httpResponseTests([
headerEnumList: ["Foo", "Bar", "Baz"],
}
},
{
id: "RestJsonInputAndOutputWithIntEnumHeaders",
documentation: "Tests responses with intEnum header bindings",
protocol: restJson1,
code: 200,
headers: {
"X-IntegerEnum": "1",
"X-IntegerEnumList": "1, 2, 3"
},
params: {
headerIntegerEnum: 1,
headerIntegerEnumList: [1, 2, 3],
}
},
{
id: "RestJsonSupportsNaNFloatHeaderOutputs",
documentation: "Supports handling NaN float header values.",
@ -371,6 +404,12 @@ structure InputAndOutputWithHeadersIO {
@httpHeader("X-EnumList")
headerEnumList: FooEnumList,
@httpHeader("X-IntegerEnum")
headerIntegerEnum: IntegerEnum,
@httpHeader("X-IntegerEnumList")
headerIntegerEnumList: IntegerEnumList,
}
/// Null and empty headers are not sent over the wire.

View File

@ -11,6 +11,8 @@ use aws.protocoltests.shared#BooleanList
use aws.protocoltests.shared#DoubleList
use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#IntegerSet
use aws.protocoltests.shared#StringList
@ -71,6 +73,10 @@ apply AllQueryStringTypes @httpRequestTests([
"EnumList=Foo",
"EnumList=Baz",
"EnumList=Bar",
"IntegerEnum=1",
"IntegerEnumList=1",
"IntegerEnumList=2",
"IntegerEnumList=3",
],
params: {
queryString: "Hello there",
@ -91,6 +97,8 @@ apply AllQueryStringTypes @httpRequestTests([
queryTimestampList: [1, 2, 3],
queryEnum: "Foo",
queryEnumList: ["Foo", "Baz", "Bar"],
queryIntegerEnum: 1,
queryIntegerEnumList: [1, 2, 3],
}
},
{
@ -243,6 +251,12 @@ structure AllQueryStringTypesInput {
@httpQuery("EnumList")
queryEnumList: FooEnumList,
@httpQuery("IntegerEnum")
queryIntegerEnum: IntegerEnum,
@httpQuery("IntegerEnumList")
queryIntegerEnumList: IntegerEnumList,
@httpQueryParams
queryParamsMapOfStringList: StringListMap,
}

View File

@ -8,6 +8,7 @@ use aws.protocols#restJson1
use aws.protocoltests.shared#BooleanList
use aws.protocoltests.shared#EpochSeconds
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#GreetingList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#NestedStringList
@ -65,6 +66,10 @@ apply JsonLists @httpRequestTests([
"Foo",
"0"
],
"intEnumList": [
1,
2
],
"nestedStringList": [
[
"foo",
@ -113,6 +118,10 @@ apply JsonLists @httpRequestTests([
"Foo",
"0"
],
"intEnumList": [
1,
2
],
"nestedStringList": [
[
"foo",
@ -204,6 +213,10 @@ apply JsonLists @httpResponseTests([
"Foo",
"0"
],
"intEnumList": [
1,
2
],
"nestedStringList": [
[
"foo",
@ -252,6 +265,10 @@ apply JsonLists @httpResponseTests([
"Foo",
"0"
],
"intEnumList": [
1,
2
],
"nestedStringList": [
[
"foo",
@ -324,6 +341,8 @@ structure JsonListsInputOutput {
enumList: FooEnumList,
intEnumList: IntegerEnumList,
nestedStringList: NestedStringList,
@jsonName("myStructureList")

View File

@ -12,6 +12,10 @@ use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#FooEnumSet
use aws.protocoltests.shared#FooEnumMap
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerEnumSet
use aws.protocoltests.shared#IntegerEnumMap
use aws.protocoltests.shared#HttpDate
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests
@ -733,6 +737,110 @@ structure JsonEnumsInputOutput {
fooEnumMap: FooEnumMap,
}
/// This example serializes intEnums as top level properties, in lists, sets, and maps.
@idempotent
@http(uri: "/JsonIntEnums", method: "PUT")
operation JsonIntEnums {
input: JsonIntEnumsInputOutput,
output: JsonIntEnumsInputOutput
}
apply JsonIntEnums @httpRequestTests([
{
id: "RestJsonJsonIntEnums",
documentation: "Serializes intEnums as integers",
protocol: restJson1,
method: "PUT",
uri: "/JsonIntEnums",
body: """
{
"integerEnum1": 1,
"integerEnum2": 2,
"integerEnum3": 3,
"integerEnumList": [
1,
2,
3
],
"integerEnumSet": [
1,
2
],
"integerEnumMap": {
"abc": 1,
"def": 2
}
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
integerEnum1: 1,
integerEnum2: 2,
integerEnum3: 3,
integerEnumList: [1, 2, 3],
integerEnumSet: [1, 2],
integerEnumMap: {
"abc": 1,
"def": 2
}
}
}
])
apply JsonIntEnums @httpResponseTests([
{
id: "RestJsonJsonIntEnums",
documentation: "Serializes intEnums as integers",
protocol: restJson1,
code: 200,
body: """
{
"integerEnum1": 1,
"integerEnum2": 2,
"integerEnum3": 3,
"integerEnumList": [
1,
2,
3
],
"integerEnumSet": [
1,
2
],
"integerEnumMap": {
"abc": 1,
"def": 2
}
}""",
bodyMediaType: "application/json",
headers: {
"Content-Type": "application/json"
},
params: {
integerEnum1: 1,
integerEnum2: 2,
integerEnum3: 3,
integerEnumList: [1, 2, 3],
integerEnumSet: [1, 2],
integerEnumMap: {
"abc": 1,
"def": 2
}
}
}
])
structure JsonIntEnumsInputOutput {
integerEnum1: IntegerEnum,
integerEnum2: IntegerEnum,
integerEnum3: IntegerEnum,
integerEnumList: IntegerEnumList,
integerEnumSet: IntegerEnumSet,
integerEnumMap: IntegerEnumMap,
}
/// Recursive shapes
@idempotent
@http(uri: "/RecursiveShapes", method: "PUT")

View File

@ -73,6 +73,7 @@ service RestJson {
SimpleScalarProperties,
JsonTimestamps,
JsonEnums,
JsonIntEnums,
RecursiveShapes,
JsonLists,
JsonMaps,

View File

@ -8,6 +8,7 @@ use aws.protocols#restXml
use aws.protocoltests.shared#BooleanList
use aws.protocoltests.shared#EpochSeconds
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#GreetingList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#NestedStringList
@ -69,6 +70,10 @@ apply XmlLists @httpRequestTests([
<member>Foo</member>
<member>0</member>
</enumList>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<nestedStringList>
<member>
<member>foo</member>
@ -118,6 +123,7 @@ apply XmlLists @httpRequestTests([
booleanList: [true, false],
timestampList: [1398796238, 1398796238],
enumList: ["Foo", "0"],
intEnumList: [1, 2],
nestedStringList: [["foo", "bar"], ["baz", "qux"]],
renamedListMembers: ["foo", "bar"],
flattenedList: ["hi", "bye"],
@ -178,6 +184,10 @@ apply XmlLists @httpResponseTests([
<member>Foo</member>
<member>0</member>
</enumList>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<nestedStringList>
<member>
<member>foo</member>
@ -231,6 +241,7 @@ apply XmlLists @httpResponseTests([
booleanList: [true, false],
timestampList: [1398796238, 1398796238],
enumList: ["Foo", "0"],
intEnumList: [1, 2],
nestedStringList: [["foo", "bar"], ["baz", "qux"]],
renamedListMembers: ["foo", "bar"],
flattenedList: ["hi", "bye"],
@ -331,6 +342,8 @@ structure XmlListsInputOutput {
enumList: FooEnumList,
intEnumList: IntegerEnumList,
nestedStringList: NestedStringList,
@xmlName("renamed")

View File

@ -12,6 +12,10 @@ use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#FooEnumSet
use aws.protocoltests.shared#FooEnumMap
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerEnumSet
use aws.protocoltests.shared#IntegerEnumMap
use aws.protocoltests.shared#HttpDate
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests
@ -1009,6 +1013,122 @@ structure XmlEnumsInputOutput {
fooEnumMap: FooEnumMap,
}
/// This example serializes enums as top level properties, in lists, sets, and maps.
@idempotent
@http(uri: "/XmlIntEnums", method: "PUT")
operation XmlIntEnums {
input: XmlIntEnumsInputOutput,
output: XmlIntEnumsInputOutput
}
apply XmlIntEnums @httpRequestTests([
{
id: "XmlIntEnums",
documentation: "Serializes simple scalar properties",
protocol: restXml,
method: "PUT",
uri: "/XmlIntEnums",
body: """
<XmlIntEnumsInputOutput>
<intEnum1>1</intEnum1>
<intEnum2>2</intEnum2>
<intEnum3>3</intEnum3>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<intEnumSet>
<member>1</member>
<member>2</member>
</intEnumSet>
<intEnumMap>
<entry>
<key>a</key>
<value>1</value>
</entry>
<entry>
<key>b</key>
<value>2</value>
</entry>
</intEnumMap>
</XmlIntEnumsInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
params: {
intEnum1: 1,
intEnum2: 2,
intEnum3: 3,
intEnumList: [1, 2],
intEnumSet: [1, 2],
intEnumMap: {
"a": 1,
"b": 2
}
}
}
])
apply XmlIntEnums @httpResponseTests([
{
id: "XmlIntEnums",
documentation: "Serializes simple scalar properties",
protocol: restXml,
code: 200,
body: """
<XmlIntEnumsInputOutput>
<intEnum1>1</intEnum1>
<intEnum2>2</intEnum2>
<intEnum3>3</intEnum3>
<intEnumList>
<member>1</member>
<member>2</member>
</intEnumList>
<intEnumSet>
<member>1</member>
<member>2</member>
</intEnumSet>
<intEnumMap>
<entry>
<key>a</key>
<value>1</value>
</entry>
<entry>
<key>b</key>
<value>2</value>
</entry>
</intEnumMap>
</XmlIntEnumsInputOutput>
""",
bodyMediaType: "application/xml",
headers: {
"Content-Type": "application/xml"
},
params: {
intEnum1: 1,
intEnum2: 2,
intEnum3: 3,
intEnumList: [1, 2],
intEnumSet: [1, 2],
intEnumMap: {
"a": 1,
"b": 2
}
}
}
])
structure XmlIntEnumsInputOutput {
intEnum1: IntegerEnum,
intEnum2: IntegerEnum,
intEnum3: IntegerEnum,
intEnumList: IntegerEnumList,
intEnumSet: IntegerEnumSet,
intEnumMap: IntegerEnumMap,
}
/// Recursive shapes
@idempotent
@http(uri: "/RecursiveShapes", method: "PUT")

View File

@ -11,6 +11,8 @@ use aws.protocoltests.shared#BooleanList
use aws.protocoltests.shared#DoubleList
use aws.protocoltests.shared#FooEnum
use aws.protocoltests.shared#FooEnumList
use aws.protocoltests.shared#IntegerEnum
use aws.protocoltests.shared#IntegerEnumList
use aws.protocoltests.shared#IntegerList
use aws.protocoltests.shared#IntegerSet
use aws.protocoltests.shared#StringList
@ -71,6 +73,9 @@ apply AllQueryStringTypes @httpRequestTests([
"EnumList=Foo",
"EnumList=Baz",
"EnumList=Bar",
"IntegerEnum=1",
"IntegerEnumList=1",
"IntegerEnumList=2",
],
params: {
queryString: "Hello there",
@ -91,6 +96,8 @@ apply AllQueryStringTypes @httpRequestTests([
queryTimestampList: [1, 2, 3],
queryEnum: "Foo",
queryEnumList: ["Foo", "Baz", "Bar"],
queryIntegerEnum: 1,
queryIntegerEnumList: [1, 2],
}
},
{
@ -217,6 +224,12 @@ structure AllQueryStringTypesInput {
@httpQuery("EnumList")
queryEnumList: FooEnumList,
@httpQuery("IntegerEnum")
queryIntegerEnum: IntegerEnum,
@httpQuery("IntegerEnumList")
queryIntegerEnumList: IntegerEnumList,
@httpQueryParams
queryParamsMapOfStrings: StringMap,
}

View File

@ -71,6 +71,7 @@ service RestXml {
XmlBlobs,
XmlTimestamps,
XmlEnums,
XmlIntEnums,
RecursiveShapes,
XmlLists,
XmlMaps,

View File

@ -120,3 +120,23 @@ structure GreetingStruct {
list GreetingList {
member: GreetingStruct
}
intEnum IntegerEnum {
A = 1
B = 2
C = 3
}
list IntegerEnumList {
member: IntegerEnum
}
@uniqueItems
list IntegerEnumSet {
member: IntegerEnum
}
map IntegerEnumMap {
key: String,
value: IntegerEnum
}