-
Notifications
You must be signed in to change notification settings - Fork 4.2k
chore(enum-updater): support adding manual static enum mappings #34441
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
chore(enum-updater): support adding manual static enum mappings #34441
Conversation
@@ -103,6 +104,16 @@ interface UnmatchedEnums { | |||
}; | |||
} | |||
|
|||
export interface ManualMappingEntry extends StaticMappingEntry { | |||
manual: boolean; |
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.
would this always be true? what if user accidentally add a entry to the manual-enum-mapping.json
but add it as false?
how does manual
get used?
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 should always be true
but the value doesnt actually matter. When creating the static mapping, we only check if an entry for the specific enum exists by the enum name, if so, we just use the entry in the manual mapping instead which would include this manual
field.
Basically the manual
field just exists so that we know a static mapping was manually updated when we look at the entry in static-enum-mapping.json
.
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 would remove this field from the manual mapping file and let the code logic add it.
sdk_service: "amplify", | ||
sdk_enum_name: "OverrideManualEnum", | ||
match_percentage: 1.0, | ||
manual: true |
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.
what happen if you add it as false
? would it still override?
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.
Yes, we check for the enum by its name, not by whether or not manual == true
.
if (!staticMapping[module]) { | ||
staticMapping[module] = {}; | ||
} | ||
staticMapping[module][enumName] = manualEnumMappings[module][enumName]; |
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 guess the manual: true
could be added here if it was not in the manual mapping file, right?
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 it to add the manual: true
here instead of having it specified in the manual overrides json file.
@@ -103,6 +104,16 @@ interface UnmatchedEnums { | |||
}; | |||
} | |||
|
|||
export interface ManualMappingEntry extends StaticMappingEntry { | |||
manual: boolean; |
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 would remove this field from the manual mapping file and let the code logic add it.
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). |
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
Manually updated PR with |
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. |
Issue # (if applicable)
Closes #.
Reason for this change
Manual changes to the
static-enum-mapping.json
would be overwritten the next time the workflow was run.Description of changes
Add a new file
manual-enum-mapping.json
that allows maintainers to add manual mappings that will be used over any matching mapping that the script calculates.Manual mappings should be added in the form:
For example:
Description of how you validated changes
Manual + unit testing
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license