-
Notifications
You must be signed in to change notification settings - Fork 869
Added PutObjectResponse to TransferUtilityUploadResponse mapping #4045
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
base: development
Are you sure you want to change the base?
Conversation
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 PR adds support for mapping PutObjectResponse to TransferUtilityUploadResponse in the AWS S3 SDK, enabling consistent property exposure across upload operations.
Key changes:
- Creates a new TransferUtilityUploadResponse class with comprehensive property mappings
- Implements ResponseMapper utility for PutObjectResponse to TransferUtilityUploadResponse conversion
- Adds extensive test coverage with JSON configuration-driven validation
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
TransferUtilityUploadResponse.cs | New response class with properties mapped from S3 upload responses |
ResponseMapper.cs | Internal utility class for mapping PutObjectResponse to TransferUtilityUploadResponse |
ResponseMapperTests.cs | Comprehensive test suite with configuration-driven validation |
mapping.json | Configuration defining field mappings between S3 request/response types |
property-aliases.json | Property name aliases for backward compatibility |
mapping-schema.json | JSON schema for validating mapping configuration structure |
AssemblyInfo.cs | Added InternalsVisibleTo attributes for test access |
433a9a6d-b8ea-4676-b763-70711e8288e4.json | Dev config file specifying patch-level change |
sdk/test/Services/S3/UnitTests/Custom/TestData/mapping-schema.json
Outdated
Show resolved
Hide resolved
72d85c3
to
2dffdee
Compare
[assembly: InternalsVisibleTo("AWSSDK.UnitTests.DynamoDBv2.NetFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100db5f59f098d27276c7833875a6263a3cc74ab17ba9a9df0b52aedbe7252745db7274d5271fd79c1f08f668ecfa8eaab5626fa76adc811d3c8fc55859b0d09d3bc0a84eecd0ba891f2b8a2fc55141cdcc37c2053d53491e650a479967c3622762977900eddbf1252ed08a2413f00a28f3a0752a81203f03ccb7f684db373518b4")] | ||
[assembly: InternalsVisibleTo("AWSSDK.UnitTests.NetFramework, PublicKey=0024000004800000940000000602000000240000525341310004000001000100db5f59f098d27276c7833875a6263a3cc74ab17ba9a9df0b52aedbe7252745db7274d5271fd79c1f08f668ecfa8eaab5626fa76adc811d3c8fc55859b0d09d3bc0a84eecd0ba891f2b8a2fc55141cdcc37c2053d53491e650a479967c3622762977900eddbf1252ed08a2413f00a28f3a0752a81203f03ccb7f684db373518b4")] | ||
<# } #> | ||
<# if (this.Config.AssemblyTitle=="AWSSDK.S3") { #> |
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 is added so we can test the internal ResponseMapper class i made
/// Contains unified response fields from both simple uploads (PutObjectResponse) | ||
/// and multipart uploads (CompleteMultipartUploadResponse). | ||
/// </summary> | ||
public class TransferUtilityUploadResponse : AmazonWebServiceResponse |
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.
right now if we release this change to development, the customer can access this class even though it wont really be used for anything until the next PRs. which i think should go in the feature branch. wondering if we should target feature/transfermanager for this change even though its not a runtime change?
@@ -0,0 +1,10 @@ | |||
{ | |||
"PropertyAliases": { |
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.
.net's property values are slightly different than whats in the mapping so i made another mapping to the .net values. the reason i didnt modify the original mapping.json is so we can copy and paste it from the SEP code directly if we ever need to update it
{ | ||
ValidateResponseDefinitionCompleteness<GetObjectResponse>( | ||
new[] { "Definition", "DownloadResponse", "GetObjectResponse" }, | ||
"GetObjectResponse", |
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.
wondering if we should be updating GetObjectResponse soon/now instead of doing this to match the model? e.g. ContentType is in the HeaderCollection property currently. but the model https://github.com/aws/aws-sdk-net/blob/main/generator/ServiceModels/s3/s3-2006-03-01.api.json#L4575 i think maps it to its own attribute @philasmar @peterrsongg ?
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.
also this test case isnt really needed as part of this work. i added it just for completeness sake. its validating that getobjectresponse has all of the expected fields in the 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.
@GarrettBeatty yeah, if it is mapped to a property on the output then we should follow the model, especially if it isn't there right now.
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 think i might just remove this test case because we dont need to copy content type to transferutilityuploadresponse anyway, so this test case really isnt validating anything important
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.
ended up removing this since if we update the getobjectresponse model anyway it will be backward compatible so the fields we have now are fine and we dont need a test for it
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.
Change looks good, but I have a question.
You're not actually calling MapPutObjectResponse
anywhere in this PR. So where does the mapping actually happen? Is that going to be part of another PR?
Approved, based on assumption that the actual mapping will happen in another PR (unless my read of this is mistaken) |
yes - description of the PR has links to the ones that will call it |
update assemblyinfo fix assembly info Add debug logging embed resource add debug logging fix test data remove schema remove uneeded tests
35dddc2
to
4f9bdfa
Compare
Description
This change creates a
TransferUtilityUploadResponse
class. This class contains the common fields betweenPutObjectResponse
andCompleteMultipartUploadResponse
. The reason it contains the common fields betweenPutObjectResponse
andCompleteMultipartUploadResponse
is because this same object should be utilized in both regular upload and multi part upload (as per the SEP).This class will be used in #4059 and #4061 Where for progress events (e.g. UploadCompleted), we return a
TransferUtilityUploadResponse
object as part of it. This class will also be used when we create new apis as part of SEP compliance (UploadWithResponseAsync
). it will be the return value of this function (instead ofvoid
like the existingUploadAsync
).In order to create this
TransferUtilityUploadResponse
class, I have created a conversion functionMapPutObjectResponse
which maps thePutObjectResponse
to theTransferUtilityUploadResponse
. Eventually, this class will also contain aMapCompletemultipartResponse
function as well #4060In order to comply with the SEP and ensure that all fields are mapped, I have added unit tests which read the
mapping.json
file from the SEP and validate that each of them get mapped in my conversion function between the two classes.Motivation and Context
Testing
Types of changes
Checklist
License