[cfnspec] CloudFormation Registry Schemas translation to CFN Specifications is lossy #9676
Labels
@aws-cdk/cfnspec
bug
This issue is a bug.
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
effort/large
Large work item – several weeks of effort
management/devenv
Related to CDK development/build environment
p1
The issue
This surfaced in #9452. We have seen this before with other teams, but never investigated enough to figure out the root cause.
The problem is that, as AWS teams are moving to the CloudFormation Registry (internal codename more well-known but I'm not going to reproduce that here) they are rewriting their property schemas in the new schema language.
That language is JSON Schema, and is more expressive than the CFN Spec. What seems to be done at the moment is that this schema is being converted back into the CFN spec on a best-effort basis. However, since the upstream schema is more expressive, some things cannot be translated, and so happen to be translated in a way that completely breaks their interpretation in the CFN schema.
Motivating example, ECS'
Options
type.It used to be defined as (some details elided):
In the new CloudFormation Registry schema language, it is now defined as:
Which should be interpreted as "the property
Options
is of a new typeOptions
, which is aMap<String>
containing keys of at least one character.This cannot be expressed in the CFN Schema for two reasons:
Map<>
types cannot be aliased.The currently generated spec looks like this:
What ends up happening is that we generate the definition of the
Options
type, but theOptions
type itself ends up as a record with no fields. CDK then promptly drops all data that used to go there, and breaks the interface definitions.Solutions
There are a number of ways to address this:
Map<>
, so we just generate those. We won't be able to derive the element type for the map though, as that information is lost.This is blocking/hampering CFNSpec imports until resolved.
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: