-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(core): improved API for tags #3465
Conversation
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've updated the title. Even if this is only a design, you'll eventually evolve it to the actual PR. Please update PR description
But I've submitted another PR for the implementation part. Do I need to close that PR and migrate those changes to this PR? |
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.
@moofish32 what do you think?
/** | ||
* add tags to the node of a construct and all its the taggable children | ||
*/ | ||
public static add(scope: Construct, key: string, value: string, props: TagProps = {}) { |
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.
since tags are essentially maps, why not something like this:
Tag.add(scope, { sfoo: 'bar' })
This will allow people to add multiple tags like this:
Tag.add(scope, {
tag1: 'value1',
tag2: 'value2'
});
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.
But tag also supports other properties like priority. See here. I would suggest Tag.add(scope, [
(tag1, 'value1', props)
(tag2, 'value2', props)
]);
but not sure if that's an over-engineer.
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.
okay, let's just leave it with Tag.add(scope, key, value[, options)
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.
Missing unit test
@iamhopaul123 could you please also submit a PR to update the developer guide: |
Improved tagging API.
Please read the contribution guidelines and follow the pull-request checklist.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license