-
Notifications
You must be signed in to change notification settings - Fork 873
Generate ListBucketMetricsConfiguration #4103
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
Generate ListBucketMetricsConfiguration #4103
Conversation
…equired query string params are set. Remove visitor pattern and move custom logic for putlifecycleconfiguration marshaller to custom partial method
|
I'm pasting the results of the AI analysis done on the larger PR here The added validation isn't a breaking change because the request will fail and throw Now I have all the information needed to provide a comprehensive analysis. Let me compare the deleted custom files with the generated ones and examine all the marshaller changes: Task Completed Breaking Changes Analysis - S3 Custom to Generated MigrationAfter analyzing all deleted custom files, their generated replacements, and modified marshallers, I have identified the following breaking changes: BREAKING CHANGES IDENTIFIED:1. AbortMultipartUploadRequestMarshaller.cs - NEW VALIDATION ADDEDIssue: Added new required field validation that didn't exist before: if (string.IsNullOrEmpty(publicRequest.UploadId))
throw new AmazonS3Exception("Request object does not have required field UploadId set");Impact: Customer code that previously could make AbortMultipartUpload requests without UploadId set will now throw an exception. 2. CopyPartRequestMarshaller.cs - NEW VALIDATIONS ADDEDIssue: Added two new required field validations: if (publicRequest.PartNumber == null)
throw new AmazonS3Exception("Request object does not have required field PartNumber set");
if (string.IsNullOrEmpty(publicRequest.UploadId))
throw new AmazonS3Exception("Request object does not have required field UploadId set");Impact: Customer code that previously could make CopyPart requests without PartNumber or UploadId set will now throw exceptions. 3. ListPartsRequestMarshaller.cs - NEW VALIDATION ADDEDIssue: Added new required field validation: if (string.IsNullOrEmpty(publicRequest.UploadId))
throw new AmazonS3Exception("Request object does not have required field UploadId set");Impact: Customer code that previously could make ListParts requests without UploadId set will now throw an exception. NO BREAKING CHANGES FOUND IN:Model Files Migration (✅ SAFE)
Differences are non-breaking:
Marshaller Logic Preservation (✅ SAFE)
SUMMARY:
The breaking changes are all related to new validation logic being added to existing marshallers rather than logic being lost during migration. These validations enforce that required fields are set before making API calls, which technically makes the SDK more strict than before. |
| BucketName = accessPointArn, | ||
| Key = "foo.txt" | ||
| Key = "foo.txt", | ||
| UploadId = "testing" |
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.
Was this supposed to be in this PR?
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.
no, that should only be in the very first PR. this change is in both branches so not sure why it is showing up 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.
okay i fixed it
...d/Model/Internal/MarshallTransformations/ListBucketMetricsConfigurationsRequestMarshaller.cs
Show resolved
Hide resolved
| { | ||
| response.Token = StringUnmarshaller.Instance.Unmarshall(context); | ||
|
|
||
| var unmarshaller = NullableBoolUnmarshaller.Instance; |
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.
Isn't t his a runtime breaking change? Before it wouldn't be returned as null even though the type was bool? and now it can. I agree the new behavior is correct now but it is different than it used to be.
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.
wouldn't this still return the same value since the underlying default value is null now? This is what the BoolUnmarshaller does
public static T Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8JsonReader reader)
{
context.Read(ref reader);
string text = context.ReadText(ref reader);
if (text == null)
return default(T);
return (T)Convert.ChangeType(text, typeof(T), CultureInfo.InvariantCulture);
}
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 BoolUnmarshaller that it was setup the simple type as:
public bool Unmarshall(XmlUnmarshallerContext context)
{
return SimpleTypeUnmarshaller<bool>.Unmarshall(context);
}
It isn't a bool?, it is a <bool> and in that case it will return False for the default when the text is null.
The NullableBoolUnmarshaller doesn't even use Default(T). It does;
public bool? Unmarshall(XmlUnmarshallerContext context)
{
context.Read();
string text = context.ReadText();
if (string.IsNullOrEmpty(text))
{
return null;
}
return bool.Parse(text);
}
So in this case if the text is null it will return null. So this is a behavior change.
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.
Ah you’re right, would you be okay with just calling this out in the changelog as a breaking change instead of adding a customization for it? I could be convinced either way but given this is fixing something I lean towards the changelog entry
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.
To make sure of my understanding the public interface is already bool? but because we were using the non nullable marshaller we would always marshal a value. But the IsTruncated element would have to exist in the xml output without a value. Essentially having a <IsTruncated />. My understanding is S3 will always returned back the IsTruncated element in the out with a value. So user's using S3, not considering S3 compatible services, will not notice any change in behavior. My suggestion is if we have a simple way to add the customization we should use it but I don't want to add any significant complexity to the SDK and generation for this.
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.
yup and I just confirmed IsTruncated will always return a value
<?xml version="1.0" encoding="UTF-8"?>
<ListMetricsConfigurationsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<IsTruncated>false</IsTruncated>
</ListMetricsConfigurationsResult>
So actually, from the user's perspective it would be the same
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.
Fair points Then it is likely safe to change it to NullableBoolUnmarshaller.
sdk/src/Services/S3/Generated/Model/ListBucketMetricsConfigurationsRequest.cs
Outdated
Show resolved
Hide resolved
sdk/src/Services/S3/Generated/Model/ListBucketMetricsConfigurationsRequest.cs
Outdated
Show resolved
Hide resolved
...d/Model/Internal/MarshallTransformations/ListBucketMetricsConfigurationsRequestMarshaller.cs
Show resolved
Hide resolved
#4121) * Generate PutBucketMetricsConfiguration and add required check for query string parameters (#4101) * Generate PutBucketMetricsConfiguration and generate check to see if required query string params are set. Remove visitor pattern and move custom logic for putlifecycleconfiguration marshaller to custom partial method * fix failing unit test for abortmultipartupload * update expectedbucketowner for pbmcrequest * Generate GetBucketMetricsConfiguration (#4102) * Generate PutBucketMetricsConfiguration and generate check to see if required query string params are set. Remove visitor pattern and move custom logic for putlifecycleconfiguration marshaller to custom partial method * generate getbucketmetricsconfiguration * fix failing unit test for abortmultipartupload * fix failing unit test for abortmultipartupload * update IsSetExpectedBucketOwner * Generate ListBucketMetricsConfiguration (#4103) * Generate PutBucketMetricsConfiguration and generate check to see if required query string params are set. Remove visitor pattern and move custom logic for putlifecycleconfiguration marshaller to custom partial method * Generate ListBucketMetricsConfiguration * generate getbucketmetricsconfiguration * fix failing unit test for abortmultipartupload * fix failing unit test for abortmultipartupload * update stringIsNullEmpty for string isSet methods * generate deletebucketmetricsconfiguration (#4104) * Generate PutBucketMetricsConfiguration and generate check to see if required query string params are set. Remove visitor pattern and move custom logic for putlifecycleconfiguration marshaller to custom partial method * Generate ListBucketMetricsConfiguration * generate getbucketmetricsconfiguration * fix failing unit test for abortmultipartupload * fix failing unit test for abortmultipartupload * generate deletebucketmetricsconfiguration * update stringIsNullEmpty for string isSet methods * fix IsSet for string properties * Consolidate DevConfigs
Description
Continuation of #4102
Motivation and Context
Generates ListBucketMetricsConfiguration
Testing
All testng done in larger PR with all 4 operations which this PR is based off of.
dry run passed
Screenshots (if appropriate)
Types of changes
Checklist
License