Timestamp struct used in models.go seems incoherent with the used date format

オープン
#26 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@skb1129 がすでに取り組んでいます。

2026年7月19日 から。

  • #126 @skb1129 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go
領域
api

調査の方向性

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

GetStream/getstream-go のほかの issue

GetStream/getstream-go の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。