Skip to content

Commit

Permalink
Update quickstart example models to match updated quickstart example …
Browse files Browse the repository at this point in the history
…syntax (#76)
  • Loading branch information
hpmellema authored Feb 26, 2024
1 parent 6868474 commit 1d7df57
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 28 deletions.
11 changes: 11 additions & 0 deletions quickstart-examples/integ/expected-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"target": "example.weather#CityId"
}
},
"properties": {
"coordinates": {
"target": "example.weather#CityCoordinates"
}
},
"read": {
"target": "example.weather#GetCity"
},
Expand Down Expand Up @@ -80,6 +85,11 @@
"target": "example.weather#CityId"
}
},
"properties": {
"chanceOfRain": {
"target": "smithy.api#Float"
}
},
"read": {
"target": "example.weather#GetForecast"
}
Expand Down Expand Up @@ -121,6 +131,7 @@
"name": {
"target": "smithy.api#String",
"traits": {
"smithy.api#notProperty": {},
"smithy.api#required": {}
}
},
Expand Down
37 changes: 23 additions & 14 deletions quickstart-examples/quickstart-cli/models/weather.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@ namespace example.weather
@paginated(inputToken: "nextToken", outputToken: "nextToken", pageSize: "pageSize")
service Weather {
version: "2006-03-01"
resources: [City]
operations: [GetCurrentTime]
resources: [
City
]
operations: [
GetCurrentTime
]
}

resource City {
identifiers: {cityId: CityId}
identifiers: { cityId: CityId }
properties: { coordinates: CityCoordinates }
read: GetCity
list: ListCities
resources: [Forecast]
resources: [
Forecast
]
}

resource Forecast {
identifiers: {cityId: CityId}
identifiers: { cityId: CityId }
properties: { chanceOfRain: Float }
read: GetForecast
}

Expand All @@ -35,14 +43,15 @@ operation GetCity {
$cityId
}

output := {
output := for City {
// "required" is used on output to indicate if the service
// will always provide a value for the member.
@required
@notProperty
name: String

@required
coordinates: CityCoordinates
$coordinates
}

errors: [
Expand Down Expand Up @@ -91,11 +100,11 @@ list CitySummaries {
}

// CitySummary contains a reference to a City.
@references(
[
{resource: City}
]
)
@references([
{
resource: City
}
])
structure CitySummary {
@required
cityId: CityId
Expand All @@ -121,7 +130,7 @@ operation GetForecast {
$cityId
}

output := {
chanceOfRain: Float
output := for Forecast {
$chanceOfRain
}
}
37 changes: 23 additions & 14 deletions quickstart-examples/quickstart-gradle/models/weather.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,27 @@ namespace example.weather
@paginated(inputToken: "nextToken", outputToken: "nextToken", pageSize: "pageSize")
service Weather {
version: "2006-03-01"
resources: [City]
operations: [GetCurrentTime]
resources: [
City
]
operations: [
GetCurrentTime
]
}

resource City {
identifiers: {cityId: CityId}
identifiers: { cityId: CityId }
properties: { coordinates: CityCoordinates }
read: GetCity
list: ListCities
resources: [Forecast]
resources: [
Forecast
]
}

resource Forecast {
identifiers: {cityId: CityId}
identifiers: { cityId: CityId }
properties: { chanceOfRain: Float }
read: GetForecast
}

Expand All @@ -35,14 +43,15 @@ operation GetCity {
$cityId
}

output := {
output := for City {
// "required" is used on output to indicate if the service
// will always provide a value for the member.
@required
@notProperty
name: String

@required
coordinates: CityCoordinates
$coordinates
}

errors: [
Expand Down Expand Up @@ -91,11 +100,11 @@ list CitySummaries {
}

// CitySummary contains a reference to a City.
@references(
[
{resource: City}
]
)
@references([
{
resource: City
}
])
structure CitySummary {
@required
cityId: CityId
Expand All @@ -121,7 +130,7 @@ operation GetForecast {
$cityId
}

output := {
chanceOfRain: Float
output := for Forecast {
$chanceOfRain
}
}

0 comments on commit 1d7df57

Please sign in to comment.