Skip to content

Commit

Permalink
Allow unknown fields while parsing json history (#1092)
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Apr 19, 2023
1 parent a090256 commit 528337f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion internal/internal_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,13 @@ func extractHistoryFromFile(jsonfileName string, lastEventID int64) (*historypb.
// HistoryFromJSON deserializes history from a reader of JSON bytes. This does
// not close the reader if it is closeable.
func HistoryFromJSON(r io.Reader, lastEventID int64) (*historypb.History, error) {
unmarshaler := jsonpb.Unmarshaler{
// Allow unknown fields because if the histroy was generated with a different version of the proto
// fields may have been added/removed.
AllowUnknownFields: true,
}
var hist historypb.History
if err := jsonpb.Unmarshal(r, &hist); err != nil {
if err := unmarshaler.Unmarshal(r, &hist); err != nil {
return nil, err
}
// If there is a last event ID, slice the rest off
Expand Down
3 changes: 2 additions & 1 deletion test/replaytests/local-activity.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
"scheduledEventId": "2",
"startedEventId": "3",
"identity": "11111@Quinn-Klassens-MacBook-Pro.local@",
"binaryChecksum": "48a264a4d5038290773fdab470dbf90b"
"binaryChecksum": "48a264a4d5038290773fdab470dbf90b",
"workerVersioningId": null
}
},
{
Expand Down

0 comments on commit 528337f

Please sign in to comment.