1+ $ version : " 2.0"
2+
3+ namespace aws.protocoltests.errorcorrection
4+
5+ use aws.api#service
6+ use aws.protocols#awsJson1_0
7+ use aws.protocols#restXml
8+ use smithy.test#httpResponseTests
9+
10+ @service (sdkId : " Error Correction Json" )
11+ @awsJson1 _0
12+ service RequiredValueJson {
13+ operations : [SayHello ],
14+ version : " 1"
15+ }
16+
17+
18+ @service (sdkId : " Error Correction Xml" )
19+ @restXml
20+ service RequiredValueXml {
21+ operations : [SayHelloXml ],
22+ version : " 1"
23+ }
24+
25+ @error (" client" )
26+ structure Error {
27+ @required
28+ requestId : String
29+
30+ @required
31+ message : String
32+ }
33+
34+ @http (method : " POST" , uri : " /" )
35+ operation SayHello { output : TestOutputDocument , errors : [Error ] }
36+
37+ @http (method : " POST" , uri : " /" )
38+ operation SayHelloXml { output : TestOutput , errors : [Error ] }
39+
40+ structure TestOutputDocument with [TestStruct ] { innerField : Nested , @required document : Document }
41+ structure TestOutput with [TestStruct ] { innerField : Nested }
42+
43+ @mixin
44+ structure TestStruct {
45+ @required
46+ foo : String ,
47+
48+ @required
49+ byteValue : Byte ,
50+
51+ @required
52+ intValue : Integer ,
53+
54+ @required
55+ listValue : StringList ,
56+
57+ @required
58+ mapValue : ListMap ,
59+
60+ @required
61+ nestedListValue : NestedList
62+
63+ @required
64+ nested : Nested
65+
66+ @required
67+ blob : Blob
68+
69+ @required
70+ enum : MyEnum
71+
72+ @required
73+ union : MyUnion
74+
75+ notRequired : String
76+
77+ @required
78+ timestampValue : Timestamp
79+ }
80+
81+ enum MyEnum {
82+ A ,
83+ B ,
84+ C
85+ }
86+
87+ union MyUnion {
88+ A : Integer ,
89+ B : String ,
90+ C : Unit
91+ }
92+
93+ structure Nested {
94+ @required
95+ a : String
96+ }
97+
98+ list StringList {
99+ member : String
100+ }
101+
102+ list NestedList {
103+ member : StringList
104+ }
105+
106+ map ListMap {
107+ key : String ,
108+ value : StringList
109+ }
110+
111+ // NOTE: there is no way to model enum or union defaults in an `httpResponseTest` because the default is the generated
112+ // "SdkUnknown" variant.
113+ apply SayHello @httpResponseTests ([
114+ {
115+ id : " error_recovery_json" ,
116+ protocol : awsJson1_0 ,
117+ params : {
118+ union : { A : 5 },
119+ enum : " A" ,
120+ foo : " " ,
121+ byteValue : 0 ,
122+ intValue : 0 ,
123+ blob : " " ,
124+ listValue : [],
125+ mapValue : {},
126+ nestedListValue : [],
127+ document : null ,
128+ nested : { a : " " },
129+ timestampValue : 0
130+ },
131+ code : 200 ,
132+ body : "{\"union\": { \"A\": 5 }, \"enum\" : \" A\" }"
133+ }
134+ ])
135+
136+ apply SayHelloXml @httpResponseTests ([
137+ {
138+ id : " error_recovery_xml" ,
139+ protocol : restXml ,
140+ params : {
141+ union : { A : 5 },
142+ enum : " A" ,
143+ foo : " " ,
144+ byteValue : 0 ,
145+ intValue : 0 ,
146+ blob : " " ,
147+ listValue : [],
148+ mapValue : {},
149+ nestedListValue : [],
150+ nested : { a : " " },
151+ timestampValue : 0
152+ },
153+ code : 200 ,
154+ body : " <TestOutput><union><A>5</A></union><enum>A</enum></TestOutput>"
155+ }
156+ ])
0 commit comments