bug: resource translation fails when a ResourceValue::Object
containing a nested TypeReference::Union
is encountered in deserialized template
#624
Labels
bug
Something isn't working
When a deserialized input template has a property that is a
ResourceValue::Object
containing a nestedTypeReference::Union
, the resource translation will fail because it is currently unimplemented -cdk-from-cfn/src/ir/resources/mod.rs
Line 133 in fd3ec9e
As an example, consider the following template:
The
Events
property is an event source that must contain one of the following event types: AlexaSkill, Api, CloudWatchEvent, CloudWatchLogs, Cognito, DocumentDB, DynamoDB, EventBridgeRule, HttpApi, IoTRule, Kinesis, MQ, MSK, S3, Schedule, ScheduleV2, SelfManagedKafka, SNS, SQS - https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-eventsource.html. As a result, the corresponding type is aTypeReference::Union(TypeUnion::Static([TypeReference::Named(_), ..]))
which translates to meaning that the event type value must be one of the event types listed above.We should add support for the
TypeReference::Union
type. This could be supported via aUnionOf
struct similar to theMapOf
struct used for theTypeReference::Map
type. Further, we need to consider how we could collapse the union type down to a specificTypeReference::Named
type based on the specific value detected.The text was updated successfully, but these errors were encountered: