我正在尝试使用 Dhall 生成 AWS Cloudformation,而我尝试编码的第一件事是AWS::ApiGatewayV2::Api。遵循 json 规范:
{
"Type" : "AWS::ApiGatewayV2::Api",
"Properties" : {
"ApiKeySelectionExpression" : String,
"BasePath" : String,
"Body" : Json,
"BodyS3Location" : BodyS3Location,
"CorsConfiguration" : Cors,
"CredentialsArn" : String,
"Description" : String,
"DisableSchemaValidation" : Boolean,
"FailOnWarnings" : Boolean,
"Name" : String,
"ProtocolType" : String,
"RouteKey" : String,
"RouteSelectionExpression" : String,
"Tags" : Json,
"Target" : String,
"Version" : String
}
}
该规范有多个字段,但其中两个形成一个联合:BodyS3Location
和Body
. 意味着其中任何一个都应该存在。我知道对动态记录的支持,但显然只适用于具有单个记录的对象。编码这种行为的推荐方法是什么?