@@ -11,11 +11,11 @@ metadata suppressions = [
11
11
namespace example.weather
12
12
13
13
use aws.auth#sigv4
14
+ use common#fakeAuth
15
+ use common#fakeProtocol
14
16
use smithy.test#httpRequestTests
15
17
use smithy.test#httpResponseTests
16
18
use smithy.waiters#waitable
17
- use common#fakeProtocol
18
- use common#fakeAuth
19
19
20
20
/// Provides weather forecasts.
21
21
@fakeProtocol
@@ -27,7 +27,9 @@ use common#fakeAuth
27
27
@paginated (inputToken : " nextToken" , outputToken : " nextToken" , pageSize : " pageSize" )
28
28
service Weather {
29
29
version : " 2006-03-01"
30
- resources : [City ]
30
+ resources : [
31
+ City
32
+ ]
31
33
operations : [
32
34
GetCurrentTime
33
35
// util-stream.integ.spec.ts
@@ -106,21 +108,26 @@ operation OnlyFakeAuthOptional {}
106
108
operation SameAsService {}
107
109
108
110
resource City {
109
- identifiers : {cityId : CityId }
111
+ identifiers : { cityId : CityId }
110
112
create : CreateCity
111
113
read : GetCity
112
114
list : ListCities
113
- resources : [Forecast , CityImage ]
114
- operations : [GetCityAnnouncements ]
115
+ resources : [
116
+ Forecast
117
+ CityImage
118
+ ]
119
+ operations : [
120
+ GetCityAnnouncements
121
+ ]
115
122
}
116
123
117
124
resource Forecast {
118
- identifiers : {cityId : CityId }
125
+ identifiers : { cityId : CityId }
119
126
read : GetForecast
120
127
}
121
128
122
129
resource CityImage {
123
- identifiers : {cityId : CityId }
130
+ identifiers : { cityId : CityId }
124
131
read : GetCityImage
125
132
}
126
133
@@ -134,32 +141,31 @@ string CityId
134
141
operation GetCity {
135
142
input : GetCityInput
136
143
output : GetCityOutput
137
- errors : [NoSuchResource ]
144
+ errors : [
145
+ NoSuchResource
146
+ ]
138
147
}
139
148
140
149
// Tests that HTTP protocol tests are generated.
141
- apply GetCity @httpRequestTests (
142
- [
143
- {
144
- id : " WriteGetCityAssertions"
145
- documentation : " Does something"
146
- protocol : " common#fakeProtocol"
147
- method : " GET"
148
- uri : " /cities/123"
149
- body : " "
150
- params : {cityId : " 123" }
151
- }
152
- ]
153
- )
150
+ apply GetCity @httpRequestTests ([
151
+ {
152
+ id : " WriteGetCityAssertions"
153
+ documentation : " Does something"
154
+ protocol : " common#fakeProtocol"
155
+ method : " GET"
156
+ uri : " /cities/123"
157
+ body : " "
158
+ params : { cityId : " 123" }
159
+ }
160
+ ])
154
161
155
- apply GetCity @httpResponseTests (
156
- [
157
- {
158
- id : " WriteGetCityResponseAssertions"
159
- documentation : " Does something"
160
- protocol : " common#fakeProtocol"
161
- code : 200
162
- body : """
162
+ apply GetCity @httpResponseTests ([
163
+ {
164
+ id : " WriteGetCityResponseAssertions"
165
+ documentation : " Does something"
166
+ protocol : " common#fakeProtocol"
167
+ code : 200
168
+ body : """
163
169
{
164
170
"name": "Seattle",
165
171
"coordinates": {
@@ -173,15 +179,14 @@ apply GetCity @httpResponseTests(
173
179
"case": "Upper"
174
180
}
175
181
}"""
176
- bodyMediaType : " application/json"
177
- params : {
178
- name : " Seattle"
179
- coordinates : {latitude : 12.34 , longitude : -56.78 }
180
- city : {cityId : " 123" , name : " Seattle" , number : " One" , case : " Upper" }
181
- }
182
+ bodyMediaType : " application/json"
183
+ params : {
184
+ name : " Seattle"
185
+ coordinates : { latitude : 12.34 , longitude : -56.78 }
186
+ city : { cityId : " 123" , name : " Seattle" , number : " One" , case : " Upper" }
182
187
}
183
- ]
184
- )
188
+ }
189
+ ] )
185
190
186
191
/// The input used to get a city.
187
192
structure GetCityInput {
@@ -246,23 +251,21 @@ structure NoSuchResource {
246
251
message : String
247
252
}
248
253
249
- apply NoSuchResource @httpResponseTests (
250
- [
251
- {
252
- id : " WriteNoSuchResourceAssertions"
253
- documentation : " Does something"
254
- protocol : " common#fakeProtocol"
255
- code : 404
256
- body : """
254
+ apply NoSuchResource @httpResponseTests ([
255
+ {
256
+ id : " WriteNoSuchResourceAssertions"
257
+ documentation : " Does something"
258
+ protocol : " common#fakeProtocol"
259
+ code : 404
260
+ body : """
257
261
{
258
262
"resourceType": "City",
259
263
"message": "Your custom message"
260
264
}"""
261
- bodyMediaType : " application/json"
262
- params : {resourceType : " City" , message : " Your custom message" }
263
- }
264
- ]
265
- )
265
+ bodyMediaType : " application/json"
266
+ params : { resourceType : " City" , message : " Your custom message" }
267
+ }
268
+ ])
266
269
267
270
// The paginated trait indicates that the operation may
268
271
// return truncated results.
@@ -275,37 +278,37 @@ apply NoSuchResource @httpResponseTests(
275
278
{
276
279
state : " success"
277
280
matcher : {
278
- output : {path : " length(items[]) > `0`" , comparator : " booleanEquals" , expected : " true" }
281
+ output : { path : " length(items[]) > `0`" , comparator : " booleanEquals" , expected : " true" }
279
282
}
280
283
}
281
284
{
282
285
state : " failure"
283
- matcher : {errorType : " NoSuchResource" }
286
+ matcher : { errorType : " NoSuchResource" }
284
287
}
285
288
]
286
289
}
287
290
)
288
291
operation ListCities {
289
292
input : ListCitiesInput
290
293
output : ListCitiesOutput
291
- errors : [NoSuchResource ]
294
+ errors : [
295
+ NoSuchResource
296
+ ]
292
297
}
293
298
294
- apply ListCities @httpRequestTests (
295
- [
296
- {
297
- id : " WriteListCitiesAssertions"
298
- documentation : " Does something"
299
- protocol : " common#fakeProtocol"
300
- method : " GET"
301
- uri : " /cities"
302
- body : " "
303
- queryParams : [" pageSize=50" ]
304
- forbidQueryParams : [" nextToken" ]
305
- params : {pageSize : 50 }
306
- }
307
- ]
308
- )
299
+ apply ListCities @httpRequestTests ([
300
+ {
301
+ id : " WriteListCitiesAssertions"
302
+ documentation : " Does something"
303
+ protocol : " common#fakeProtocol"
304
+ method : " GET"
305
+ uri : " /cities"
306
+ body : " "
307
+ queryParams : [" pageSize=50" ]
308
+ forbidQueryParams : [" nextToken" ]
309
+ params : { pageSize : 50 }
310
+ }
311
+ ])
309
312
310
313
structure ListCitiesInput {
311
314
@httpQuery (" nextToken" )
@@ -328,11 +331,11 @@ list CitySummaries {
328
331
}
329
332
330
333
// CitySummary contains a reference to a City.
331
- @references (
332
- [
333
- { resource : City }
334
- ]
335
- )
334
+ @references ([
335
+ {
336
+ resource : City
337
+ }
338
+ ] )
336
339
structure CitySummary {
337
340
@required
338
341
cityId : CityId
@@ -426,7 +429,9 @@ map StringMap {
426
429
operation GetCityImage {
427
430
input : GetCityImageInput
428
431
output : GetCityImageOutput
429
- errors : [NoSuchResource ]
432
+ errors : [
433
+ NoSuchResource
434
+ ]
430
435
}
431
436
432
437
structure GetCityImageInput {
@@ -450,7 +455,9 @@ blob CityImageData
450
455
operation GetCityAnnouncements {
451
456
input : GetCityAnnouncementsInput
452
457
output : GetCityAnnouncementsOutput
453
- errors : [NoSuchResource ]
458
+ errors : [
459
+ NoSuchResource
460
+ ]
454
461
}
455
462
456
463
structure GetCityAnnouncementsInput {
@@ -480,28 +487,24 @@ structure Message {
480
487
}
481
488
482
489
apply Weather @smithy.rules#endpointRuleSet ({
483
- "version" : " 1.3" ,
484
- "parameters" : {
485
- "Region" : {
486
- "required" : true ,
487
- "type" : " String" ,
488
- "documentation" : " docs"
490
+ version : " 1.3"
491
+ parameters : {
492
+ Region : { required : true , type : " String" , documentation : " docs" }
489
493
}
490
- },
491
- "rules" : [
492
- {
493
- "conditions" : [],
494
- "documentation" : " base rule" ,
495
- "endpoint" : {
496
- "url" : " https://{Region}.amazonaws.com" ,
497
- "properties" : {},
498
- "headers" : {}
499
- },
500
- "type" : " endpoint"
501
- }
502
- ]
494
+ rules : [
495
+ {
496
+ conditions : []
497
+ documentation : " base rule"
498
+ endpoint : {
499
+ url : " https://{Region}.amazonaws.com"
500
+ properties : {}
501
+ headers : {}
502
+ }
503
+ type : " endpoint"
504
+ }
505
+ ]
503
506
})
504
507
505
508
apply Weather @smithy.rules#clientContextParams (
506
- Region : {type : " string" , documentation : " docs" }
509
+ Region : { type : " string" , documentation : " docs" }
507
510
)
0 commit comments