2022-08-20 04:29:05 +08:00
|
|
|
$version: "2.0"
|
2021-05-20 02:40:54 +08:00
|
|
|
namespace aws.protocoltests.restxml
|
|
|
|
|
|
|
|
use aws.protocols#restXml
|
|
|
|
use aws.api#service
|
|
|
|
use smithy.test#httpResponseTests
|
2021-06-01 23:56:56 +08:00
|
|
|
use smithy.test#httpRequestTests
|
2021-05-20 02:40:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
/// A REST XML service that sends XML requests and responses.
|
|
|
|
@service(sdkId: "Rest XML Protocol")
|
|
|
|
@restXml
|
|
|
|
service RestXmlExtras {
|
|
|
|
version: "2019-12-16",
|
2021-06-22 05:05:15 +08:00
|
|
|
operations: [
|
|
|
|
AttributeParty,
|
|
|
|
XmlMapsFlattenedNestedXmlNamespace,
|
|
|
|
EnumKeys,
|
|
|
|
PrimitiveIntOpXml,
|
2021-06-22 07:03:31 +08:00
|
|
|
ChecksumRequired,
|
|
|
|
StringHeader,
|
2021-09-15 01:53:29 +08:00
|
|
|
CreateFoo,
|
2022-10-13 19:51:10 +08:00
|
|
|
RequiredMember,
|
2021-06-22 05:05:15 +08:00
|
|
|
]
|
2021-06-03 03:48:03 +08:00
|
|
|
}
|
|
|
|
|
2021-09-15 01:53:29 +08:00
|
|
|
/// This operation triggers a name collision between the synthetic `CreateFooInput` and `CreateFooInput`
|
|
|
|
@http(uri: "/reused-input", method: "POST")
|
|
|
|
operation CreateFoo {
|
|
|
|
input: CreateFooRequest,
|
|
|
|
}
|
|
|
|
|
|
|
|
structure CreateFooRequest {
|
|
|
|
input: CreateFooInput
|
|
|
|
}
|
|
|
|
|
|
|
|
structure CreateFooInput {}
|
|
|
|
|
2021-06-03 03:48:03 +08:00
|
|
|
@httpRequestTests([{
|
|
|
|
id: "RestXmlSerPrimitiveIntUnset",
|
|
|
|
protocol: "aws.protocols#restXml",
|
|
|
|
documentation: "Primitive ints should not be serialized when they are unset",
|
|
|
|
uri: "/primitive-document",
|
|
|
|
method: "POST",
|
|
|
|
body: """
|
|
|
|
<PrimitiveIntDocument>
|
|
|
|
</PrimitiveIntDocument>
|
|
|
|
""",
|
|
|
|
bodyMediaType: "application/xml",
|
2022-08-20 04:29:05 +08:00
|
|
|
params: { }
|
2021-06-03 03:48:03 +08:00
|
|
|
}, {
|
2022-08-20 04:29:05 +08:00
|
|
|
id: "RestXmlSerPrimitiveIntSetToDefault",
|
2021-06-03 03:48:03 +08:00
|
|
|
protocol: "aws.protocols#restXml",
|
|
|
|
documentation: "Primitive ints should not be serialized when they are unset",
|
|
|
|
uri: "/primitive-document",
|
|
|
|
method: "POST",
|
|
|
|
body: """
|
|
|
|
<PrimitiveIntDocument>
|
|
|
|
<value>1</value>
|
2022-08-20 04:29:05 +08:00
|
|
|
</PrimitiveIntDocument>
|
2021-06-03 03:48:03 +08:00
|
|
|
""",
|
|
|
|
bodyMediaType: "application/xml",
|
|
|
|
params: { value: 1 }
|
|
|
|
}])
|
|
|
|
@http(uri: "/primitive-document", method: "POST")
|
|
|
|
operation PrimitiveIntOpXml {
|
|
|
|
input: PrimitiveIntDocument,
|
|
|
|
output: PrimitiveIntDocument
|
|
|
|
}
|
|
|
|
|
|
|
|
structure PrimitiveIntDocument {
|
2022-08-20 04:29:05 +08:00
|
|
|
value: PrimitiveInt
|
|
|
|
@default(0)
|
|
|
|
defaultedValue: PrimitiveInt
|
2021-05-20 02:40:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
@enum([{"value": "enumvalue", "name": "V"}])
|
|
|
|
string StringEnum
|
|
|
|
|
|
|
|
integer PrimitiveInt
|
|
|
|
|
|
|
|
structure AttributePartyInputOutput {
|
|
|
|
@xmlAttribute
|
|
|
|
enum: StringEnum,
|
|
|
|
|
|
|
|
@xmlAttribute
|
|
|
|
@xmlName("prefix:anumber")
|
|
|
|
number: PrimitiveInt,
|
|
|
|
|
|
|
|
@xmlAttribute
|
|
|
|
ts: Timestamp,
|
|
|
|
|
|
|
|
@xmlAttribute
|
|
|
|
bool: Boolean
|
|
|
|
}
|
|
|
|
|
2021-06-01 23:56:56 +08:00
|
|
|
structure XmlMapEnumKeys {
|
|
|
|
data: EnumKeyMap
|
|
|
|
}
|
|
|
|
|
|
|
|
map EnumKeyMap {
|
|
|
|
key: StringEnum,
|
|
|
|
value: String
|
|
|
|
}
|
|
|
|
|
|
|
|
@httpResponseTests([{
|
|
|
|
id: "DeserEnumMap",
|
|
|
|
code: 200,
|
|
|
|
body: "<XmlMapEnumKeys><data><entry><key>enumvalue</key><value>hello</value></entry></data></XmlMapEnumKeys>",
|
|
|
|
params: {
|
|
|
|
data: { "enumvalue": "hello" }
|
|
|
|
},
|
|
|
|
bodyMediaType: "application/xml",
|
|
|
|
protocol: "aws.protocols#restXml"
|
|
|
|
}])
|
|
|
|
@httpRequestTests([{
|
|
|
|
id: "SerEnumMap",
|
|
|
|
method: "POST",
|
|
|
|
body: "<XmlMapEnumKeys><data><entry><key>enumvalue</key><value>hello</value></entry></data></XmlMapEnumKeys>",
|
|
|
|
uri: "/enumkeys",
|
|
|
|
bodyMediaType: "application/xml",
|
|
|
|
params: {
|
|
|
|
data: { "enumvalue": "hello" }
|
|
|
|
},
|
|
|
|
protocol: "aws.protocols#restXml"
|
|
|
|
}])
|
|
|
|
@http(uri: "/enumkeys", method: "POST")
|
|
|
|
operation EnumKeys {
|
|
|
|
input: XmlMapEnumKeys,
|
|
|
|
output: XmlMapEnumKeys
|
|
|
|
}
|
|
|
|
|
2021-05-20 02:40:54 +08:00
|
|
|
@httpResponseTests([{
|
|
|
|
id: "DeserAttributes",
|
|
|
|
code: 200,
|
|
|
|
body: "<AttributePartyInputOutput enum=\"enumvalue\" prefix:anumber=\"5\" ts=\"1985-04-12T23:20:50.00Z\" bool=\"true\"/>",
|
|
|
|
params: {
|
|
|
|
enum: "enumvalue",
|
|
|
|
number: 5,
|
|
|
|
ts: 482196050,
|
|
|
|
bool: true
|
|
|
|
},
|
|
|
|
protocol: "aws.protocols#restXml"
|
|
|
|
|
|
|
|
}])
|
|
|
|
@http(uri: "/AttributeParty", method: "POST")
|
|
|
|
operation AttributeParty {
|
|
|
|
output: AttributePartyInputOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
@httpResponseTests([{
|
|
|
|
id: "DeserFlatNamespaceMaps",
|
|
|
|
code: 200,
|
|
|
|
body: "<XmlMapsFlattenedNestedXmlNamespaceInputOutput xmlns=\"http://aoo.com\"><myMap><yek xmlns=\"http://doo.com\">map2</yek><eulav xmlns=\"http://eoo.com\"><entry><K xmlns=\"http://goo.com\">third</K><V xmlns=\"http://hoo.com\">plz</V></entry><entry><K xmlns=\"http://goo.com\">fourth</K><V xmlns=\"http://hoo.com\">onegai</V></entry></eulav></myMap><myMap><yek xmlns=\"http://doo.com\">map1</yek><eulav xmlns=\"http://eoo.com\"><entry><K xmlns=\"http://goo.com\">second</K><V xmlns=\"http://hoo.com\">konnichiwa</V></entry><entry><K xmlns=\"http://goo.com\">first</K><V xmlns=\"http://hoo.com\">hi</V></entry></eulav></myMap></XmlMapsFlattenedNestedXmlNamespaceInput>",
|
|
|
|
params: {
|
|
|
|
"myMap": {
|
|
|
|
"map2": {"fourth": "onegai", "third": "plz" },
|
|
|
|
"map1": {"second": "konnichiwa", "first": "hi" }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
protocol: "aws.protocols#restXml"
|
|
|
|
}])
|
|
|
|
@http(uri: "/XmlMapsFlattenedNestedXmlNamespace", method: "POST")
|
|
|
|
operation XmlMapsFlattenedNestedXmlNamespace {
|
|
|
|
input: XmlMapsFlattenedNestedXmlNamespaceInputOutput,
|
|
|
|
output: XmlMapsFlattenedNestedXmlNamespaceInputOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
@xmlNamespace(uri: "http://aoo.com")
|
|
|
|
structure XmlMapsFlattenedNestedXmlNamespaceInputOutput {
|
|
|
|
@xmlNamespace(uri: "http://boo.com")
|
|
|
|
@xmlFlattened
|
|
|
|
myMap: XmlMapsNestedNamespaceInputOutputMap,
|
|
|
|
}
|
|
|
|
|
|
|
|
@xmlNamespace(uri: "http://coo.com")
|
|
|
|
map XmlMapsNestedNamespaceInputOutputMap {
|
|
|
|
@xmlNamespace(uri: "http://doo.com")
|
|
|
|
@xmlName("yek")
|
|
|
|
key: String,
|
|
|
|
|
|
|
|
@xmlNamespace(uri: "http://eoo.com")
|
|
|
|
@xmlName("eulav")
|
|
|
|
value: XmlMapsNestedNestedNamespaceInputOutputMap
|
|
|
|
}
|
|
|
|
|
|
|
|
@xmlNamespace(uri: "http://foo.com")
|
|
|
|
map XmlMapsNestedNestedNamespaceInputOutputMap {
|
|
|
|
@xmlNamespace(uri: "http://goo.com")
|
|
|
|
@xmlName("K")
|
|
|
|
key: String,
|
|
|
|
|
|
|
|
@xmlNamespace(uri: "http://hoo.com")
|
|
|
|
@xmlName("V")
|
|
|
|
value: String
|
|
|
|
}
|
2021-06-22 05:05:15 +08:00
|
|
|
|
|
|
|
@httpRequestTests([{
|
|
|
|
id: "ChecksumRequiredHeader",
|
|
|
|
method: "POST",
|
|
|
|
body: "<ChecksumRequiredInput><field>hello</field></ChecksumRequiredInput>",
|
|
|
|
uri: "/ChecksumRequired",
|
|
|
|
bodyMediaType: "application/xml",
|
|
|
|
params: {
|
|
|
|
field: "hello"
|
|
|
|
},
|
2021-07-28 23:29:02 +08:00
|
|
|
headers: { "Content-Md5": "JAJAqYA61wMhATGeQqRcMQ==" },
|
2021-06-22 05:05:15 +08:00
|
|
|
protocol: "aws.protocols#restXml"
|
|
|
|
}])
|
|
|
|
@httpChecksumRequired
|
|
|
|
@http(uri: "/ChecksumRequired", method: "POST")
|
|
|
|
operation ChecksumRequired {
|
|
|
|
input: ChecksumRequiredInput
|
|
|
|
}
|
|
|
|
|
|
|
|
structure ChecksumRequiredInput {
|
|
|
|
field: String
|
|
|
|
}
|
2021-06-22 07:03:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
@httpResponseTests([{
|
|
|
|
id: "DeserHeaderStringCommas",
|
|
|
|
code: 200,
|
|
|
|
documentation: """
|
|
|
|
Regression test for https://github.com/awslabs/aws-sdk-rust/issues/122
|
|
|
|
where `,` was eagerly used to split fields in cases where the input was not
|
|
|
|
a list.
|
|
|
|
""",
|
|
|
|
body: "",
|
|
|
|
headers: { "x-field": "a,b,c" },
|
|
|
|
params: {
|
|
|
|
field: "a,b,c"
|
|
|
|
},
|
|
|
|
protocol: "aws.protocols#restXml"
|
|
|
|
}])
|
|
|
|
@http(uri: "/StringHeader", method: "POST")
|
|
|
|
operation StringHeader {
|
|
|
|
output: StringHeaderOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
structure StringHeaderOutput {
|
|
|
|
@httpHeader("x-field")
|
|
|
|
field: String,
|
|
|
|
|
|
|
|
@httpHeader("x-enum")
|
2022-10-13 19:51:10 +08:00
|
|
|
enumHeader: StringEnum,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// This operation tests that we can serialize `required` members.
|
|
|
|
@http(uri: "/required-member", method: "GET")
|
|
|
|
operation RequiredMember {
|
|
|
|
input: RequiredMemberInputOutput
|
|
|
|
output: RequiredMemberInputOutput
|
|
|
|
}
|
|
|
|
|
|
|
|
structure RequiredMemberInputOutput {
|
|
|
|
@required
|
|
|
|
requiredString: String
|
2021-06-22 07:03:31 +08:00
|
|
|
}
|