Skip to content
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

fix: update modified field handling for blob and bucket with json transport to properly clear fields #2664

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

BenWhitehead
Copy link
Collaborator

Update StorageImpl#update(BlobInfo) and StorageImpl#update(BucketInfo) to only send modified fields in the case of an actual update. Currently, it simply sends the json version of the current info, this can mean that if a field is cleared the request to gcs doesn't actually include the field to clear.

This same issue does not impact grpc transport, because grpc transport has an explicit update_mask that is populated.

Add some tests to ensure things work and continue to work.

In order to handle this, we have to explicitly include a Data.nullOf(Class) in the respective apiary model. Each of the Data.nullOfs must match the type of the field. Because of this, we now need to track the apiary type for each field. To this end, a new internal field has been added to BlobField and BucketField to map to the corresponding apiary type.

Fixes #2662

@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Aug 12, 2024
@BenWhitehead BenWhitehead requested a review from a team as a code owner August 12, 2024 21:14
@BenWhitehead BenWhitehead changed the title ix: update modified field handling for blob and bucket with json transport to properly clear fields fix: update modified field handling for blob and bucket with json transport to properly clear fields Aug 12, 2024
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: storage Issues related to the googleapis/java-storage API. labels Aug 12, 2024
…nsport to properly clear fields

Update StorageImpl#update(BlobInfo) and StorageImpl#update(BucketInfo) to only send modified fields in the case of an actual update. Currently, it simply sends the json version of the current info, this can mean that if a field is cleared the request to gcs doesn't actually include the field to clear.

This same issue does not impact grpc transport, because grpc transport has an explicit `update_mask` that is populated.

Fixes #2662
@BenWhitehead BenWhitehead merged commit e2f5537 into main Aug 15, 2024
20 of 21 checks passed
@BenWhitehead BenWhitehead deleted the fix-2662 branch August 15, 2024 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. owlbot:ignore instruct owl-bot to ignore a PR size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

com.google.cloud.storage.Storage: Cannot clear BlobInfo attributes on update
2 participants