-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle nested properties in cfn schema generation
- Loading branch information
1 parent
b2df554
commit 86720ec
Showing
3 changed files
with
126 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...tware/amazon/smithy/aws/cloudformation/schema/fromsmithy/integ/nested-properties.cfn.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"typeName": "Smithy::TestService::Forecast", | ||
"description": "Definition of Smithy::TestService::Forecast Resource Type", | ||
"properties": { | ||
"ChanceOfRain": { | ||
"type": "number" | ||
}, | ||
"ForecastId": { | ||
"type": "string" | ||
} | ||
}, | ||
"createOnlyProperties": [ | ||
"/properties/ForecastId" | ||
], | ||
"primaryIdentifier": [ | ||
"/properties/ForecastId" | ||
], | ||
"handlers": { | ||
"create": { | ||
"permissions": [ | ||
"testservice:CreateForecast", | ||
"testservice:PutForecast" | ||
] | ||
}, | ||
"read": { | ||
"permissions": [ | ||
"testservice:GetForecast" | ||
] | ||
}, | ||
"update": { | ||
"permissions": [ | ||
"testservice:PutForecast", | ||
"testservice:UpdateForecast" | ||
] | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |
67 changes: 67 additions & 0 deletions
67
...oftware/amazon/smithy/aws/cloudformation/schema/fromsmithy/integ/nested-properties.smithy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
$version: "2.0" | ||
|
||
namespace smithy.example | ||
|
||
use aws.cloudformation#cfnMutability | ||
use aws.cloudformation#cfnResource | ||
|
||
service TestService { | ||
version: "2020-07-02", | ||
resources: [Forecast] | ||
} | ||
|
||
@cfnResource() | ||
resource Forecast { | ||
identifiers: { | ||
forecastId: String | ||
} | ||
properties: { | ||
chanceOfRain: Float | ||
} | ||
read: GetForecast | ||
put: PutForecast | ||
create: CreateForecast | ||
update: UpdateForecast | ||
} | ||
|
||
@readonly | ||
operation GetForecast { | ||
input := { | ||
@required | ||
forecastId: String | ||
} | ||
output := { | ||
@nestedProperties | ||
forecastData: ForecastData | ||
} | ||
} | ||
|
||
@idempotent | ||
operation PutForecast { | ||
input := { | ||
@required | ||
forecastId: String | ||
@nestedProperties | ||
forecastData: ForecastData | ||
} | ||
} | ||
|
||
operation CreateForecast { | ||
input := { | ||
@nestedProperties | ||
forecastData: ForecastData | ||
} | ||
} | ||
|
||
operation UpdateForecast { | ||
input := { | ||
@required | ||
forecastId: String | ||
@nestedProperties | ||
forecastData: ForecastData | ||
} | ||
} | ||
|
||
structure ForecastData for Forecast { | ||
$chanceOfRain | ||
} |