Skip to content

Commit 4a5fdf0

Browse files
authored
chore: apply smithy formatter to test model (#1204)
1 parent 9fd07df commit 4a5fdf0

File tree

1 file changed

+99
-96
lines changed
  • smithy-typescript-codegen-test/model/weather

1 file changed

+99
-96
lines changed

smithy-typescript-codegen-test/model/weather/main.smithy

+99-96
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ metadata suppressions = [
1111
namespace example.weather
1212

1313
use aws.auth#sigv4
14+
use common#fakeAuth
15+
use common#fakeProtocol
1416
use smithy.test#httpRequestTests
1517
use smithy.test#httpResponseTests
1618
use smithy.waiters#waitable
17-
use common#fakeProtocol
18-
use common#fakeAuth
1919

2020
/// Provides weather forecasts.
2121
@fakeProtocol
@@ -27,7 +27,9 @@ use common#fakeAuth
2727
@paginated(inputToken: "nextToken", outputToken: "nextToken", pageSize: "pageSize")
2828
service Weather {
2929
version: "2006-03-01"
30-
resources: [City]
30+
resources: [
31+
City
32+
]
3133
operations: [
3234
GetCurrentTime
3335
// util-stream.integ.spec.ts
@@ -106,21 +108,26 @@ operation OnlyFakeAuthOptional {}
106108
operation SameAsService {}
107109

108110
resource City {
109-
identifiers: {cityId: CityId}
111+
identifiers: { cityId: CityId }
110112
create: CreateCity
111113
read: GetCity
112114
list: ListCities
113-
resources: [Forecast, CityImage]
114-
operations: [GetCityAnnouncements]
115+
resources: [
116+
Forecast
117+
CityImage
118+
]
119+
operations: [
120+
GetCityAnnouncements
121+
]
115122
}
116123

117124
resource Forecast {
118-
identifiers: {cityId: CityId}
125+
identifiers: { cityId: CityId }
119126
read: GetForecast
120127
}
121128

122129
resource CityImage {
123-
identifiers: {cityId: CityId}
130+
identifiers: { cityId: CityId }
124131
read: GetCityImage
125132
}
126133

@@ -134,32 +141,31 @@ string CityId
134141
operation GetCity {
135142
input: GetCityInput
136143
output: GetCityOutput
137-
errors: [NoSuchResource]
144+
errors: [
145+
NoSuchResource
146+
]
138147
}
139148

140149
// 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+
])
154161

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: """
163169
{
164170
"name": "Seattle",
165171
"coordinates": {
@@ -173,15 +179,14 @@ apply GetCity @httpResponseTests(
173179
"case": "Upper"
174180
}
175181
}"""
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" }
182187
}
183-
]
184-
)
188+
}
189+
])
185190

186191
/// The input used to get a city.
187192
structure GetCityInput {
@@ -246,23 +251,21 @@ structure NoSuchResource {
246251
message: String
247252
}
248253

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: """
257261
{
258262
"resourceType": "City",
259263
"message": "Your custom message"
260264
}"""
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+
])
266269

267270
// The paginated trait indicates that the operation may
268271
// return truncated results.
@@ -275,37 +278,37 @@ apply NoSuchResource @httpResponseTests(
275278
{
276279
state: "success"
277280
matcher: {
278-
output: {path: "length(items[]) > `0`", comparator: "booleanEquals", expected: "true"}
281+
output: { path: "length(items[]) > `0`", comparator: "booleanEquals", expected: "true" }
279282
}
280283
}
281284
{
282285
state: "failure"
283-
matcher: {errorType: "NoSuchResource"}
286+
matcher: { errorType: "NoSuchResource" }
284287
}
285288
]
286289
}
287290
)
288291
operation ListCities {
289292
input: ListCitiesInput
290293
output: ListCitiesOutput
291-
errors: [NoSuchResource]
294+
errors: [
295+
NoSuchResource
296+
]
292297
}
293298

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+
])
309312

310313
structure ListCitiesInput {
311314
@httpQuery("nextToken")
@@ -328,11 +331,11 @@ list CitySummaries {
328331
}
329332

330333
// CitySummary contains a reference to a City.
331-
@references(
332-
[
333-
{resource: City}
334-
]
335-
)
334+
@references([
335+
{
336+
resource: City
337+
}
338+
])
336339
structure CitySummary {
337340
@required
338341
cityId: CityId
@@ -426,7 +429,9 @@ map StringMap {
426429
operation GetCityImage {
427430
input: GetCityImageInput
428431
output: GetCityImageOutput
429-
errors: [NoSuchResource]
432+
errors: [
433+
NoSuchResource
434+
]
430435
}
431436

432437
structure GetCityImageInput {
@@ -450,7 +455,9 @@ blob CityImageData
450455
operation GetCityAnnouncements {
451456
input: GetCityAnnouncementsInput
452457
output: GetCityAnnouncementsOutput
453-
errors: [NoSuchResource]
458+
errors: [
459+
NoSuchResource
460+
]
454461
}
455462

456463
structure GetCityAnnouncementsInput {
@@ -480,28 +487,24 @@ structure Message {
480487
}
481488

482489
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" }
489493
}
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+
]
503506
})
504507

505508
apply Weather @smithy.rules#clientContextParams(
506-
Region: {type: "string", documentation: "docs"}
509+
Region: { type: "string", documentation: "docs" }
507510
)

0 commit comments

Comments
 (0)