-
Notifications
You must be signed in to change notification settings - Fork 874
Generate 8 more s3 operations #3893
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
Conversation
| } | ||
|
|
||
| }, | ||
| "treatEnumsAsEnums":{ |
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.
Instead of making up the new term treatEnumsAsEnums which by itself sounds weird because if set it false then what does it treat enums if not enums. I suggest reusing the existing term and possible add an Override prefix. For example have a customization called OverrideTreatEnumsAsString and then add ObjectAttributesList with a value false.
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.
thanks for the suggestion, I like that name much better. Changed it and updated customizations.json file as well.
| /// <summary> | ||
| /// For Lists of enums, the generator automatically treats the enum as a string via passing in true to "treatEnumAsString". | ||
| /// This customization overrides that so that the enum is treated as an enum. | ||
| /// "treatEnumsAsEnums":{ |
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.
You need to update the example to match the rename to OverrideTreatEnumsAsString
|
|
||
| }, | ||
| "overrideTreatEnumsAsString":{ | ||
| "ObjectAttributesList": 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.
Shouldn't this be false since we want to turn off treating the enum as a string. I'm viewing this customization is allowing the user manually specify the exact value for the treatEnumAsString parameter on DetermineType.
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 DetermineType() by default passes in false for treatEnumsAsString and there is no way to call DetermineType(JsonData extendedData, bool treatEnumsAsString, bool useNullable = true) outside the Member.cs class I was thinking that this customization would override the default value which is why I passed in true here meaning. "Override the default value of false".
| { | ||
| var data = _documentRoot[OverrideTreatEnumsAsStringKey]; | ||
| if (data == null) return false; | ||
| return data[shapeName] == null ? false : 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.
Since the objects in the list have a value of true or false whether we should treat enums as strings we should check the value here and not just whether it exists.
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 we're now changing what OverrideTreatEnumsAsString represents, I think we have to return null if the value doesn't exist, and otherwise just return the value.
| case "list": | ||
| var listType = DetermineType(memberShape["member"], true, false); | ||
| // if customization exists to treat the enum as an enum instead of a string, we pass in false | ||
| var listType = this.model.Customizations.OverrideTreatEnumsAsString(this.Extends) ? DetermineType(memberShape["member"], false, false) : DetermineType(memberShape["member"], true, false) ; |
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 ?: can be reduced down DetermineType(memberShape["member"], this.model.Customizations.OverrideTreatEnumsAsString(this.Extends), false)
| case "map": | ||
| var keyType = DetermineType(memberShape["key"], true, false); | ||
| var valueType = DetermineType(memberShape["value"], true, false); | ||
| bool overrideMapTreatEnumsAsString = this.model.Customizations.OverrideTreatEnumsAsString(this.Extends) ?? 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.
Why do we need to use Extends 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.
I used Extends here b/c I'm just trying to grab the name of the shape that the member targets rather than than the name of the member itself since this is a shape-level modification and not a member-level modification
…es, GetObjectLegalHold, GetObjectLockConfiguration
cb07319 to
e70b14d
Compare
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.
Pull Request Overview
This pull request generates 8 additional S3 operations: GetBucketTagging, GetBucketRequestPayment, GetObjectAttributes, GetObjectLegalHold, GetObjectLockConfiguration, GetObjectRetention, GetObjectTagging, and GetPublicAccessBlock. The changes involve removing custom implementation files to enable code generation for these operations and introducing a new customization "TreatEnumsAsEnum" to handle List types properly in S3.
Key changes:
- Removed custom model and marshaller files for several S3 operations to enable automatic code generation
- Added "TreatEnumsAsEnum" customization to override enum handling for specific shapes
- Updated service model configuration to enable generation of the 8 new operations
Reviewed Changes
Copilot reviewed 13 out of 67 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| PublicAccessBlockConfiguration.cs | Removed custom model to enable code generation |
| GetPublicAccessBlockRequestMarshaller.cs | Removed custom marshaller to enable code generation |
| GetObjectTaggingRequestMarshaller.cs | Removed custom marshaller to enable code generation |
| GetBucketTaggingRequestMarshaller.cs | Removed custom marshaller to enable code generation |
| GetBucketRequestPaymentRequestMarshaller.cs | Removed custom marshaller to enable code generation |
| GetObjectTaggingResponse.cs | Removed custom response model to enable code generation |
| GetBucketTaggingResponse.cs | Removed custom response model to enable code generation |
| s3.customizations.json | Added customizations for enum handling and property naming |
| ServiceModel.cs | Enabled 8 new S3 operations and updated exception handling lists |
| Member.cs | Added logic to respect TreatEnumsAsString override customization |
| GeneratorDriver.cs | Minor whitespace cleanup |
| Customizations.cs | Added OverrideTreatEnumsAsString customization support |
| 816a028b-eb1b-4f17-9d9c-a0373bcd8ced.json | Added changelog entry for the new operations |
| "renameShape": "S3StorageClass" | ||
| }, | ||
| "Payer":{ | ||
| "renameShape": "string" |
Copilot
AI
Jul 30, 2025
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 shape rename from 'Payer' to 'string' appears to contradict the PR's goal of treating enums as enums rather than strings. This should be consistent with the new TreatEnumsAsEnum customization approach.
| "renameShape": "string" | |
| "renameShape": "PayerType" |
Description
Generates the following operations:
I added a customization "TreatEnumsAsEnum". For List types, enum types are generated as strings, which in S3 isn't always the case. There are cases where List is written in custom code. If this customization is used it will treat the enum as an enum instead of as a string.
Motivation and Context
Testing
Dry run passes DRY_RUN-e40d50e6-0c92-4258-9f40-5829631b3698
No backwards incompatible changes (re-ran 10:58AM PST 06/24/25)
Additional sanity testing:
Screenshots (if appropriate)
Types of changes
Checklist
License