feat: interoperable Cloud Assembly contract #133
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Relates to aws/aws-cdk#32998
Reason for this change
We are publishing the
cx-api
package twice: Once as a standalone package@aws-cdk/cx-api
and once as part of the construct library underaws-cdk-lib/cx-api
. The code is copied during the release and the same versions of the packages will have the same code.However this makes it difficult for other packages to take a type dependency on types from this package. The most common class that's used from
cx-api
isCloudAssembly
- the result ofapp.synth()
. Previously a package had to take a dependency on the very largeaws-cdk-lib
just to use a single type. It would be better if other packages could instead depend on the smaller, much more focused@aws-cdk/cx-api
package.Description of changes
In aws/aws-cdk#32998 we are adding a mechanism to detect cross-library compatibility of the
CloudAssembly
class. However, that alone doesn't help us with type checking. Instead we introduce a new typeICloudAssembly
into the Cloud Assembly Schema. This interface only declares a single property:directory
. Consumers can use this type to indicate where they would like to receive aCloudAssembly
. They can then use runtime code to either confirm a provided object already satisfies the requirements or fallback to creating a newCloudAssembly
from the directory.