1- $ version : " 0.4 .0"
1+ $ version : " 1 .0"
22namespace example.weather
33
44use smithy.test#httpRequestTests
55use smithy.test#httpResponseTests
66
77/// Provides weather forecasts.
8- @protocols ([{ name : " aws.rest-json-1.1 " }])
8+ @fakeProtocol
99@paginated (inputToken : " nextToken" , outputToken : " nextToken" , pageSize : " pageSize" )
1010service Weather {
1111 version : " 2006-03-01" ,
@@ -18,6 +18,7 @@ resource City {
1818 read : GetCity ,
1919 list : ListCities ,
2020 resources : [Forecast , CityImage ],
21+ operations : [GetCityAnnouncements ]
2122}
2223
2324resource Forecast {
@@ -47,7 +48,7 @@ apply GetCity @httpRequestTests([
4748 {
4849 id : " WriteGetCityAssertions" ,
4950 documentation : " Does something" ,
50- protocol : " aws.rest-json-1.1 " ,
51+ protocol : " example.weather#fakeProtocol " ,
5152 method : " GET" ,
5253 uri : " /cities/123" ,
5354 body : " " ,
@@ -61,7 +62,7 @@ apply GetCity @httpResponseTests([
6162 {
6263 id : " WriteGetCityResponseAssertions" ,
6364 documentation : " Does something" ,
64- protocol : " aws.rest-json-1.1 " ,
65+ protocol : " example.weather#fakeProtocol " ,
6566 code : 200 ,
6667 body : """
6768 {
@@ -139,7 +140,7 @@ apply NoSuchResource @httpResponseTests([
139140 {
140141 id : " WriteNoSuchResourceAssertions" ,
141142 documentation : " Does something" ,
142- protocol : " aws.rest-json-1.1 " ,
143+ protocol : " example.weather#fakeProtocol " ,
143144 code : 404 ,
144145 body : """
145146 {
@@ -168,7 +169,7 @@ apply ListCities @httpRequestTests([
168169 {
169170 id : " WriteListCitiesAssertions" ,
170171 documentation : " Does something" ,
171- protocol : " aws.rest-json-1.1 " ,
172+ protocol : " example.weather#fakeProtocol " ,
172173 method : " GET" ,
173174 uri : " /cities" ,
174175 body : " " ,
@@ -241,6 +242,7 @@ structure GetForecastInput {
241242
242243structure GetForecastOutput {
243244 chanceOfRain : Float ,
245+ precipitation : Precipitation ,
244246}
245247
246248union Precipitation {
@@ -251,15 +253,16 @@ union Precipitation {
251253 mixed : TypedYesNo ,
252254 other : OtherStructure ,
253255 blob : Blob ,
256+ foo : example.weather.nested#Foo ,
254257 baz : example.weather.nested.more#Baz ,
255258}
256259
257260structure OtherStructure {}
258261
259- @enum ("YES": { }, "NO" : {} )
262+ @enum ([{ value : " YES" }, { value : " NO" }] )
260263string SimpleYesNo
261264
262- @enum ("YES": { name: "YES"}, "NO" : { name : " NO" })
265+ @enum ([{ value : " YES" , name : " YES" }, { value : " NO" , name : " NO" }] )
263266string TypedYesNo
264267
265268map StringMap {
@@ -281,9 +284,49 @@ structure GetCityImageInput {
281284}
282285
283286structure GetCityImageOutput {
284- @streaming
285287 @httpPayload
286288 image : CityImageData ,
287289}
288290
291+ @streaming
289292blob 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