-
Notifications
You must be signed in to change notification settings - Fork 870
[V3] Rename ErrorType exception properties to avoid hiding inherited member #4089
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
[V3] Rename ErrorType exception properties to avoid hiding inherited member #4089
Conversation
| /// A string containing the overridden property name if a special case applies, | ||
| /// or null if the default property name should be used. | ||
| /// </returns> | ||
| private string GetPropertyNameOverride() |
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 feel like this method name is a bit misleading. It suggests that we can override any property name but in reality it only overrides exception names and only if it is "ErrorType". Can we rename this to GetExceptionNameOverride or something along that line?
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 intentional incase in the future was wanted to override other properties names for any reason, otherwise I would have added this if condition to the BasePropertyName.
Currently we are adding 3 lines in BasePropertyName to call two line in GetPropertyNameOverride, if we are sure we will never override any property for any reason then I think this method should be removed.
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.
Well, usually we would override a property name by making an entry in the Customization.json file and then using PropertyModifier or ShapeModifier. I would think that hardcoding an override based on the existence of a string is a pretty niche use-case
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.
For example: https://github.com/aws/aws-sdk-net/blob/main/generator/ServiceClientGeneratorLib/Member.cs#L231
We have a method GetPropertyModifier that allows us to override the name of a property. For any other override, we would usually make an entry and then call this method.
I get why you didn't use that b/c we don't want to have to do that every time a property of ErrorType shows up, but i think in most cases we would use the method available GetPropertyModifier
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 use this one for two reasons:
- It it under customizations, so updating it will make it seem like this is a customization rather than a manual override.
- It does much more than overriding the name, it accepts shape name and property name so wont know inside the shape type (though we can add an extra parameter with default value so this isn't a major concern), and it also returns a
PropertyModifierwhich is a very rich object not just a name modification.
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, since it's a private method I'm not too adamant about changing the name.
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.
just to be clear i wasn't suggesting you use the customization, just that there is another method with a very similar name in that class
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.
Now I see that you weren't suggesting that after rereading your comment :D, I'm open to removing it though so let's see what the second reviewer thinks.
d6381fa to
9c13e38
Compare
Description
This change resolves a naming conflict in exception classes where the
ErrorTypeproperty could hide the inheritedErrorTypemember from the baseAmazonServiceExceptionclass.Also removed previous customization approach at
AccountServicein favor of the generator-level fix, which caused the private property name to change but the pubic properties stayed that same.Motivation and Context
DOTNET-8305Testing
AccountServicewas affect by this change.DRY_RUN-545fa4f9-fa52-429e-8579-fb9b15978715Screenshots (if appropriate)
Types of changes
Checklist
License