Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions generator/.DevConfigs/816a028b-eb1b-4f17-9d9c-a0373bcd8ced.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Generate GetBucketRequestPayment, GetBucketTagging, and GetObjectAttributes, GetObjectLegalHold, GetObjectLockConfiguration, GetObjectRetention, GetObjectTagging, GetPublicAccessBlock"
]
}
]
}
20 changes: 19 additions & 1 deletion generator/ServiceClientGeneratorLib/Customizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public class CustomizationsModel
public const string OverrideContentTypeKey = "overrideContentType";
public const string StopPaginationOnSameTokenKey = "stopPaginationOnSameToken";
public const string OriginalMemberKey = "originalMember";

public const string OverrideTreatEnumsAsStringKey = "overrideTreatEnumsAsString";
JsonData _documentRoot;

SimpleMethodFormsModel _simpleMethodsModel;
Expand Down Expand Up @@ -600,6 +600,24 @@ public List<string> NoArgOverloads
}
}

/// <summary>
/// For Lists of enums, the generator automatically treats the enum as a string via passing in true to "treatEnumAsString".
/// This customization sets the "treatEnumAsString" value to whatever is set here. This can be used outside of list of enums
/// but this is just one example of how it can be used.
/// "overrideTreatEnumsAsString":{
/// "ObjectAttributesList": false
/// }
///
/// </summary>
/// <returns></returns>
public bool? OverrideTreatEnumsAsString(string shapeName)
{
var data = _documentRoot[OverrideTreatEnumsAsStringKey];
if (data == null || data[shapeName] == null) return null;

return (bool)data[shapeName];
}

private HashSet<string> _resultGenerationSuppressions = null;

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion generator/ServiceClientGeneratorLib/GeneratorDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ public void Execute()
this.ExecuteGenerator(new ServiceEnumerations(), enumFileName);
}


// Any paginators for the service
// skip paginators for s3 until we're at the end of s3 client generation
if (Configuration.ServiceModel.HasPaginators && Configuration.ServiceId != "S3")
Expand Down
8 changes: 5 additions & 3 deletions generator/ServiceClientGeneratorLib/Member.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,13 @@ private string DetermineType(JsonData extendedData, bool treatEnumsAsString, boo
}
return typeName;
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;
Copy link
Contributor

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?

Copy link
Contributor Author

@peterrsongg peterrsongg Jun 24, 2025

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

var keyType = DetermineType(memberShape["key"], overrideMapTreatEnumsAsString, false);
var valueType = DetermineType(memberShape["value"], overrideMapTreatEnumsAsString, false);
return string.Format("Dictionary<{0}, {1}>", keyType, valueType);
case "list":
var listType = DetermineType(memberShape["member"], true, false);
bool overrideListTreatEnumsAsString = this.model.Customizations.OverrideTreatEnumsAsString(this.Extends) ?? true;
var listType = DetermineType(memberShape["member"], overrideListTreatEnumsAsString, false);
return string.Format("List<{0}>", listType);

case "decimal":
Expand Down
23 changes: 13 additions & 10 deletions generator/ServiceClientGeneratorLib/ServiceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,16 +493,16 @@ public List<Operation> S3AllowListOperations
new Operation(this, "GetBucketPolicy", DocumentRoot[OperationsKey]["GetBucketPolicy"]),
new Operation(this, "GetBucketPolicyStatus", DocumentRoot[OperationsKey]["GetBucketPolicyStatus"]),
new Operation(this, "GetBucketReplication", DocumentRoot[OperationsKey]["GetBucketReplication"]),
//new Operation(this, "GetBucketRequestPayment", DocumentRoot[OperationsKey]["GetBucketRequestPayment"]),
//new Operation(this, "GetBucketTagging", DocumentRoot[OperationsKey]["GetBucketTagging"]),
new Operation(this, "GetBucketRequestPayment", DocumentRoot[OperationsKey]["GetBucketRequestPayment"]),
new Operation(this, "GetBucketTagging", DocumentRoot[OperationsKey]["GetBucketTagging"]),
//new Operation(this, "GetBucketVersioning", DocumentRoot[OperationsKey]["GetBucketVersioning"]),
//new Operation(this, "GetBucketWebsite", DocumentRoot[OperationsKey]["GetBucketWebsite"]),
//new Operation(this, "GetObjectAttributes", DocumentRoot[OperationsKey]["GetObjectAttributes"]),
//new Operation(this, "GetObjectLegalHold", DocumentRoot[OperationsKey]["GetObjectLegalHold"]),
//new Operation(this, "GetObjectLockConfiguration", DocumentRoot[OperationsKey]["GetObjectLockConfiguration"]),
//new Operation(this, "GetObjectRetention", DocumentRoot[OperationsKey]["GetObjectRetention"]),
//new Operation(this, "GetObjectTagging", DocumentRoot[OperationsKey]["GetObjectTagging"]),
//new Operation(this, "GetPublicAccessBlock", DocumentRoot[OperationsKey]["GetPublicAccessBlock"]),
new Operation(this, "GetObjectAttributes", DocumentRoot[OperationsKey]["GetObjectAttributes"]),
new Operation(this, "GetObjectLegalHold", DocumentRoot[OperationsKey]["GetObjectLegalHold"]),
new Operation(this, "GetObjectLockConfiguration", DocumentRoot[OperationsKey]["GetObjectLockConfiguration"]),
new Operation(this, "GetObjectRetention", DocumentRoot[OperationsKey]["GetObjectRetention"]),
new Operation(this, "GetObjectTagging", DocumentRoot[OperationsKey]["GetObjectTagging"]),
new Operation(this, "GetPublicAccessBlock", DocumentRoot[OperationsKey]["GetPublicAccessBlock"]),
//new Operation(this, "HeadBucket", DocumentRoot[OperationsKey]["HeadBucket"]),
//new Operation(this, "ListBucketAnalyticsConfigurations", DocumentRoot[OperationsKey]["ListBucketAnalyticsConfigurations"]),
//new Operation(this, "ListBucketIntelligentTieringConfigurations", DocumentRoot[OperationsKey]["ListBucketIntelligentTieringConfigurations"]),
Expand Down Expand Up @@ -542,7 +542,9 @@ public List<string> S3AddParametersList
_s3AddParametersList = new List<string>
{
"ListBuckets",
"ListDirectoryBuckets"
"ListDirectoryBuckets",
"GetObjectLegalHold",
"GetObjectRetention"
};
}
return _s3AddParametersList;
Expand All @@ -567,7 +569,8 @@ public List<string> S3RequestMarshallerThrowGenericExceptionList
{
_s3RequestMarshallerThrowAmazonS3ExceptionList = new List<string>()
{
"CreateSession"
"CreateSession",
"GetObjectAttributes"
};
}
return _s3RequestMarshallerThrowAmazonS3ExceptionList;
Expand Down
14 changes: 14 additions & 0 deletions generator/ServiceModels/s3/s3.customizations.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@
}
]
},
"GetObjectTaggingOutput":{
"modify":[
{
"TagSet": {"emitPropertyName": "Tagging"}
}
]
},
"LifecycleRule": {
"modify": [
{
Expand Down Expand Up @@ -381,6 +388,13 @@
},
"StorageClass":{
"renameShape": "S3StorageClass"
},
"Payer":{
"renameShape": "string"
Copy link

Copilot AI Jul 30, 2025

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.

Suggested change
"renameShape": "string"
"renameShape": "PayerType"

Copilot uses AI. Check for mistakes.
}

},
"overrideTreatEnumsAsString":{
"ObjectAttributesList": false
}
}
47 changes: 0 additions & 47 deletions sdk/src/Services/S3/Custom/Model/GetBucketTaggingResponse.cs

This file was deleted.

39 changes: 0 additions & 39 deletions sdk/src/Services/S3/Custom/Model/GetObjectTaggingResponse.cs

This file was deleted.

This file was deleted.

This file was deleted.

Loading