[PR #972] [MERGED] Format "generation" field in Pubsub notification as a string #1079

Closed
opened 2026-03-03 12:32:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/972
Author: @danmcgee-soda
Created: 10/28/2022
Status: Merged
Merged: 10/31/2022
Merged by: @fsouza

Base: mainHead: notification-generation-string


📝 Commits (1)

  • eddd2c1 Format "generation" field in Pubsub notification as a string

📊 Changes

2 files changed (+6 additions, -6 deletions)

View changed files

📝 internal/notification/event.go (+5 -5)
📝 internal/notification/event_test.go (+1 -1)

📄 Description

As documented in the storage objects JSON object representation, all fields are "string formatted as the specified value type", including numbers.

https://cloud.google.com/storage/docs/json_api/v1/objects#resource-representations

strconv.FormatInt was used for the "size" field, but this wasn't done for generation.

We noticed this when doing local testing, and the messages failed JSON unmarshalling from fake-gcs-server, but were properly unmarshalling from real Google Cloud Storage pubsub messages.

Screen Shot 2022-10-28 at 12 20 35 PM Screen Shot 2022-10-28 at 12 20 39 PM

🔄 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/972 **Author:** [@danmcgee-soda](https://github.com/danmcgee-soda) **Created:** 10/28/2022 **Status:** ✅ Merged **Merged:** 10/31/2022 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `notification-generation-string` --- ### 📝 Commits (1) - [`eddd2c1`](https://github.com/fsouza/fake-gcs-server/commit/eddd2c1bbd34f3cb2f206dfa7da34b888d245f7e) Format "generation" field in Pubsub notification as a string ### 📊 Changes **2 files changed** (+6 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `internal/notification/event.go` (+5 -5) 📝 `internal/notification/event_test.go` (+1 -1) </details> ### 📄 Description As documented in the storage objects JSON object representation, all fields are "string formatted as the specified value type", including numbers. https://cloud.google.com/storage/docs/json_api/v1/objects#resource-representations `strconv.FormatInt` was used for the "size" field, but this wasn't done for generation. We noticed this when doing local testing, and the messages failed JSON unmarshalling from fake-gcs-server, but were properly unmarshalling from real Google Cloud Storage pubsub messages. <img width="740" alt="Screen Shot 2022-10-28 at 12 20 35 PM" src="https://user-images.githubusercontent.com/87710586/198714128-eed9fb30-9b18-46ec-937e-a4566350c3de.png"> <img width="479" alt="Screen Shot 2022-10-28 at 12 20 39 PM" src="https://user-images.githubusercontent.com/87710586/198714137-6a2536c8-0d69-44e1-bc69-13c8da6e8839.png"> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:32:57 +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#1079
No description provided.