1
- $ version : " 0.4 .0"
1
+ $ version : " 1 .0"
2
2
namespace example.weather
3
3
4
4
use smithy.test#httpRequestTests
5
5
use smithy.test#httpResponseTests
6
6
7
7
/// Provides weather forecasts.
8
- @protocols ([{ name : " aws.rest-json-1.1 " }])
8
+ @fakeProtocol
9
9
@paginated (inputToken : " nextToken" , outputToken : " nextToken" , pageSize : " pageSize" )
10
10
service Weather {
11
11
version : " 2006-03-01" ,
@@ -18,6 +18,7 @@ resource City {
18
18
read : GetCity ,
19
19
list : ListCities ,
20
20
resources : [Forecast , CityImage ],
21
+ operations : [GetCityAnnouncements ]
21
22
}
22
23
23
24
resource Forecast {
@@ -47,7 +48,7 @@ apply GetCity @httpRequestTests([
47
48
{
48
49
id : " WriteGetCityAssertions" ,
49
50
documentation : " Does something" ,
50
- protocol : " aws.rest-json-1.1 " ,
51
+ protocol : " example.weather#fakeProtocol " ,
51
52
method : " GET" ,
52
53
uri : " /cities/123" ,
53
54
body : " " ,
@@ -61,7 +62,7 @@ apply GetCity @httpResponseTests([
61
62
{
62
63
id : " WriteGetCityResponseAssertions" ,
63
64
documentation : " Does something" ,
64
- protocol : " aws.rest-json-1.1 " ,
65
+ protocol : " example.weather#fakeProtocol " ,
65
66
code : 200 ,
66
67
body : """
67
68
{
@@ -139,7 +140,7 @@ apply NoSuchResource @httpResponseTests([
139
140
{
140
141
id : " WriteNoSuchResourceAssertions" ,
141
142
documentation : " Does something" ,
142
- protocol : " aws.rest-json-1.1 " ,
143
+ protocol : " example.weather#fakeProtocol " ,
143
144
code : 404 ,
144
145
body : """
145
146
{
@@ -168,7 +169,7 @@ apply ListCities @httpRequestTests([
168
169
{
169
170
id : " WriteListCitiesAssertions" ,
170
171
documentation : " Does something" ,
171
- protocol : " aws.rest-json-1.1 " ,
172
+ protocol : " example.weather#fakeProtocol " ,
172
173
method : " GET" ,
173
174
uri : " /cities" ,
174
175
body : " " ,
@@ -241,6 +242,7 @@ structure GetForecastInput {
241
242
242
243
structure GetForecastOutput {
243
244
chanceOfRain : Float ,
245
+ precipitation : Precipitation ,
244
246
}
245
247
246
248
union Precipitation {
@@ -251,15 +253,16 @@ union Precipitation {
251
253
mixed : TypedYesNo ,
252
254
other : OtherStructure ,
253
255
blob : Blob ,
256
+ foo : example.weather.nested#Foo ,
254
257
baz : example.weather.nested.more#Baz ,
255
258
}
256
259
257
260
structure OtherStructure {}
258
261
259
- @enum ("YES": { }, "NO" : {} )
262
+ @enum ([{ value : " YES" }, { value : " NO" }] )
260
263
string SimpleYesNo
261
264
262
- @enum ("YES": { name: "YES"}, "NO" : { name : " NO" })
265
+ @enum ([{ value : " YES" , name : " YES" }, { value : " NO" , name : " NO" }] )
263
266
string TypedYesNo
264
267
265
268
map StringMap {
@@ -281,9 +284,49 @@ structure GetCityImageInput {
281
284
}
282
285
283
286
structure GetCityImageOutput {
284
- @streaming
285
287
@httpPayload
286
288
image : CityImageData ,
287
289
}
288
290
291
+ @streaming
289
292
blob CityImageData
293
+
294
+ @readonly
295
+ @http (method : " GET" , uri : " /cities/{cityId}/announcements" )
296
+ operation GetCityAnnouncements {
297
+ input : GetCityAnnouncementsInput ,
298
+ output : GetCityAnnouncementsOutput ,
299
+ errors : [NoSuchResource ]
300
+ }
301
+
302
+
303
+ structure GetCityAnnouncementsInput {
304
+ @required
305
+ @httpLabel
306
+ cityId : CityId ,
307
+ }
308
+
309
+ structure GetCityAnnouncementsOutput {
310
+ @httpHeader (" x-last-updated" )
311
+ lastUpdated : Timestamp ,
312
+
313
+ @httpPayload
314
+ announcements : Announcements
315
+ }
316
+
317
+ @streaming
318
+ union Announcements {
319
+ police : Message ,
320
+ fire : Message ,
321
+ health : Message
322
+ }
323
+
324
+ structure Message {
325
+ message : String ,
326
+ author : String
327
+ }
328
+
329
+ // Define a fake protocol trait for use.
330
+ @trait
331
+ @protocolDefinition
332
+ structure fakeProtocol {}
0 commit comments