Skip to content
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(attribute/cti): make attribute/cti respect manually set attributes #415

Merged
merged 2 commits into from
Apr 20, 2020

Conversation

tonyjwalt
Copy link
Contributor

Issue #, if available: 414

Description of changes:

  • Make attribute/cti not overwrite existing attributes
  • Only build out cti attributes to the length of the path
  • Add tests for attribute/cti

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment on lines 79 to 81
prop.path.forEach((leaf, i) => {
generatedAttrs[attrNames[i]] = leaf;
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if prop.path.length > attrNames.length, then line 80 will set generatedAttrs[undefined] to the last leaf value in prop.path.

This would be new behavior. Maybe the loop should be forced to only run a maximum of 5 times?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch. I updated the loop to terminate if either array runs out of values so that you can change the length of the attrNames array in the future. I'll commit that now.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@chazzmoney
Copy link
Collaborator

Hi Tony,

Thank you for this! I agree that this would be a better situation than our current setup.

Can you check out the comment I posted? Its just a thought about managing the length of the two arrays being used together.

Thanks!

@chazzmoney
Copy link
Collaborator

LGTM :shipit:

@chazzmoney chazzmoney merged commit fb3e393 into amzn:master Apr 20, 2020
@tonyjwalt tonyjwalt deleted the feature/updateAttrCTI branch May 5, 2020 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants