Timestamp struct used in models.go seems incoherent with the used date format
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
getstream-go/models.go と getstream/rfc3339.go を読み、まず Timestamp MarshalJSON メソッドと UnmarshalJSON メソッドを確認します。それらが想定する入力を issue に示されたタイムスタンプ形式と比較し、代表的なイベント payload に対する動作を検証します。文書化された形式に従ってイベントの日付を一貫して unmarshaled できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi guys, I’m implementing a webhook handler that listens to GetStream Call events. To ease events payload unmarshaling, I’m trying to use the events structs in getstream-go/models.go. But it seems that the date type Timestamp is not coherent with the date format sent by Getstream in the events payloads.
type Timestamp struct {
Time *time.Time
}
func (t Timestamp) MarshalJSON() ([]byte, error) {
return json.Marshal(t.Time)
}
func (t *Timestamp) UnmarshalJSON(data []byte) error {
strData := string(data)
if strData == "null" {
return nil
}
ns, err := strconv.ParseInt(strData, 10, 64)
if err != nil {
return fmt.Errorf("failed to parse timestamp: %w", err)
}
utcT := time.Unix(0, ns).UTC()
t.Time = &utcT
return nil
}
With this implementation from getstream/rfc3339.go, the date format should be something like « 1739803521 » but the GetStream events payload contains the dates in that format: « 2025-02-13T16:45:22.746736895Z ».
So the UnmarshalJSON method can’t be used right away.
Is it the expected behavior?
- 主要言語
- Go
- スター
- 8
- フォーク
- 3
- 平均マージ
- 29分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GetStream/getstream-go のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
GetStream/getstream-go#172 · コメント 9 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
GetStream/getstream-go#25 ·
メンテナーはふだん 1 日以内に返信
GetStream/getstream-go の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
SAP/crossplane-provider-btp#1175 ·
メンテナーはふだん 1 日以内に返信
-
adk: stream concatenation errors bypass retry and failover対応中かも @OUAO-FRANK が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
google/osv-scalibr#2586 ·
メンテナーはふだん 2 日以内に返信
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
stacklok/toolhive-catalog#1890 ·
メンテナーはふだん 1 日以内に返信
-
heap: pushing an item that is already queued corrupts the index対応中かも @lbarrosby が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kubernetes-sigs/kwok#1800 ·
メンテナーはふだん 1 日以内に返信