[PR #1592] [MERGED] Don't omit versioning.enabled in bucket response #1637

Closed
opened 2026-03-03 12:35:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1592
Author: @manuteleco
Created: 5/4/2024
Status: Merged
Merged: 5/4/2024
Merged by: @fsouza

Base: mainHead: dont_omit_false_values_in_versioning_enabled


📝 Commits (1)

  • 99eba7a Don't omit versioning.enabled in bucket response

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 fakestorage/response.go (+1 -1)

📄 Description

In Go's json package, false qualifies as empty value for the purposes of marshalling (see Marshal docs).

In the bucket JSON response, the versioning.enabled attribute should still be present even when it is false. If omitted, some client libraries fail to deserialize the response.

This commit changes the marshalling of versioning from:

"versioning": {}

to:

"versioning": {
  "enabled": false
}

I didn't bother writing a test for this, as it felt overkill, but let me know if you disagree.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/1592 **Author:** [@manuteleco](https://github.com/manuteleco) **Created:** 5/4/2024 **Status:** ✅ Merged **Merged:** 5/4/2024 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `dont_omit_false_values_in_versioning_enabled` --- ### 📝 Commits (1) - [`99eba7a`](https://github.com/fsouza/fake-gcs-server/commit/99eba7a30198baa26b635c68431990a33c36c1a1) Don't omit `versioning.enabled` in bucket response ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/response.go` (+1 -1) </details> ### 📄 Description In Go's `json` package, `false` qualifies as _empty_ value for the purposes of marshalling (see `Marshal` [docs][1]). In the bucket JSON response, the `versioning.enabled` attribute should still be present even when it is `false`. If omitted, some [client libraries][2] fail to deserialize the response. This commit changes the marshalling of `versioning` from: ```json "versioning": {} ``` to: ```json "versioning": { "enabled": false } ``` [1]: https://pkg.go.dev/encoding/json#Marshal [2]: https://crates.io/crates/google-cloud-storage --- I didn't bother writing a test for this, as it felt overkill, but let me know if you disagree. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:35:31 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#1637
No description provided.