-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(core): improvements to Construct API #2767
Conversation
Ensure documentation coverage and clean up of the various APIs. Fixes #1891 BREAKING CHANGE: * **core:** `StackProps.autoDeploy` has been removed and replaced by `StackProps.hide` (with negated logic). * **core:** `ISynthesizable.synthesize` now accepts an `ISynthesisSession` which contains the `CloudAssemblyBuilder` object. * **cx-api:** Multiple changes to the cloud assembly APIs to reduce surface area and clean up.
BREAKING CHANGE: - `StackProps.autoDeploy` renamed to `entrypoint` (still true by default). - CLI must be upgraded to 0.34.0 (cx protocol changes)
BREAKING CHANGE: * **core:** `node.validateTree` is now `ConstructNode.validate(node)` * **core:** `node.prepareTree` is now `ConstructNode.prepare(node)` * **core:** `node.getContext` is now `node.tryGetContext` * **core:** `node.recordReference` is now `node.addReference` * **core:** `node.apply` is now `node.applyAspect` * **core:** `node.ancestors()` is now `node.scopes` * **core:** `node.required` has been removed. * **core:** `node.typename` has been removed. * **core:** `node.addChild` is now private * **core:** `node.findReferences()` is now `node.references` * **core:** `node.findDependencieS()` is now `node.dependencies` * **core:** `stack.dependencies()` is now `stack.dependencies` * **core:** `construct.node.stack` is now `Stack.of(construct)` * **core:** `CfnElement.stackPath` has been removed.
BREAKING CHANGE: * **core:** `node.resolve` has been moved to `stack.resolve`. * **core:** `node.stringifyJson` has been moved to `stack.stringifyJson`.
I think the last commit does things that aren't necessary:
Weren't we talking about removing
Actually this method could go as well. It does nothing that Yes, this couples it to CloudFormation (we lose target language abstraction), but in all instances where we're calling it, we're calling it from the context of a Construct Library resource which already knows it's going to be deployed using CloudFormation (same situation as where we would be using |
I tried to look into moving
I think |
packages/@aws-cdk/cdk/lib/stack.ts
Outdated
/** | ||
* Convert an object, potentially containing tokens, to a JSON string | ||
*/ | ||
public stringifyJson(obj: any): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not stringify JSON, it stringifies stuff to CFN-y Json. I don't love that method name, and I kinda think stringify
or toJsonString
is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I like toJsonString
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rix0rrr what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah cool
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Closes #1934
BREAKING CHANGE:
node.stack
is nowStack.of(construct)
(fixes Deprecatenode.stack
#2766)node.resolve
has been moved tostack.resolve
.node.stringifyJson
has been moved tostack.stringifyJson
.node.validateTree
is nowConstructNode.validate(node)
node.prepareTree
is nowConstructNode.prepare(node)
node.getContext
is nownode.tryGetContext
node.recordReference
is nownode.addReference
node.apply
is nownode.applyAspect
node.ancestors()
is nownode.scopes
node.required
has been removed.node.typename
has been removed.node.addChild
is now privatenode.findReferences()
is nownode.references
node.findDependencies()
is nownode.dependencies
stack.dependencies()
is nowstack.dependencies
CfnElement.stackPath
has been removed.CloudFormationLang
is now internal (usestack.toJsonString()
)Pull Request Checklist
design
folderBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.