-
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
fix(cloudformation-include): drops unknown policy attributes #32321
Conversation
Unknown fields in `CreationPolicy`/`UpdatePolicy` were dropped while loading resources using `CfnInclude`. In this PR, handle unknown fields in those places like unknown fields in other places: retain them during parsing and add them as overrides.
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
}); | ||
const sig = new ObjectParser<CfnResourceSignal>(p); | ||
sig.parse('count', 'Count', FromCloudFormation.getNumber); | ||
sig.parse('timeout', 'Tiemout', FromCloudFormation.getString); |
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.
sig.parse('timeout', 'Tiemout', FromCloudFormation.getString); | |
sig.parse('timeout', 'Timeout', FromCloudFormation.getString); |
Perhaps we could have special method, built on top of parse
, that converts the cases automatically, to reduce the risk of typos like this one.
parseConvertingCase('timeout', FromCloudFormation.getString);
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32321 +/- ##
==========================================
+ Coverage 78.46% 78.50% +0.03%
==========================================
Files 106 106
Lines 7208 7201 -7
Branches 1323 1321 -2
==========================================
- Hits 5656 5653 -3
+ Misses 1364 1361 -3
+ Partials 188 187 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
} | ||
|
||
// eslint-disable-next-line max-len | ||
public parse<K extends keyof T>(targetKey: K, key: string, parser: (x: any) => T[K] | FromCloudFormationResult<T[K] | IResolvable>) { |
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.
public parse<K extends keyof T>(targetKey: K, key: string, parser: (x: any) => T[K] | FromCloudFormationResult<T[K] | IResolvable>) { | |
public parse<K extends Extract<keyof T, string>>(targetKey: K, key: Capitalize<K>, parser: (x: any) => T[K] | FromCloudFormationResult<T[K] | IResolvable>) { |
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 I agree with @otaviomacedo A simple firstCharUpper
would be even 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.
I didn't because we can't assume this is true in general. But I guess this is on a small enough domain that it's always true here.
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.
Didn't know about Capitalize
btw. That's neat.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…b.com:aws/aws-cdk into huijbers/parse-unrecognized-policy-attributes
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
…b.com:aws/aws-cdk into huijbers/parse-unrecognized-policy-attributes
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Unknown fields in
CreationPolicy
/UpdatePolicy
were dropped while loading resources usingCfnInclude
.In this PR, handle unknown fields in those places like unknown fields in other places: retain them during parsing and add them as overrides.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license