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.
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
fix(cdk): merge cloudFormation tags with aspect tags #1762
fix(cdk): merge cloudFormation tags with aspect tags #1762
Changes from 4 commits
9a3fade
65c0596
18ce625
4305741
708eff3
455d697
15aa430
15da077
8eebcc9
87eca86
9d8119b
d0281ee
e026e52
5724be9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
According to our naming standards the name of this interface should not start with an
I
since it doesn't have any behavior.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.
I'm probably thick, but I'm going to need more information on what this member does. It seems to be mapping a tag name to an index in the the
tags
array, but why? Is it just for fast lookup by name?Why do we not have something like this instead:
If the goal is to be able to switch tags off on demand (by using
RemoveTag
) while not completely losing track of them, another data structure in theMap<>
to keep that state will do nicely: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 whole confusion was me not understanding the JSII error above was telling me that I was leaking a private type. Refactored this to use Map where appropriate.
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.
tagType
is only used to pick the right type of formatter. So we could replace the whole enum meber with an instance ofITagFormatter
. We could have this instead:Muy simpler!
If you want to keep the enum for the caller's convenience, do the lookup in the constructor. You can also use an object to house the lookup map:
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.
I preferred to leave the codegen with just the simple enum and moved to the
const TAG_FORMATTERS ...
pattern. If you strongly otherwise I'll move it to codegen.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.
I don't particularly like that this thing can handle both arrays and objects, because we lose type information this way. It should just handle arrays, and the
MapFormatter
should just do the object assignment directly.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.
Fair - I did this so I could later flip the precedence, but moved it back as you requested.
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.
Haha