From da768dfd997b90f191b5e4412ec1d24ecaf04b64 Mon Sep 17 00:00:00 2001 From: Ruben Rizzi Date: Tue, 13 Feb 2024 11:27:44 +0000 Subject: [PATCH] DifferentialQuery api returns an error when there are no Reviewers in the response (#39) --- entities/differential.go | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/entities/differential.go b/entities/differential.go index 05f0699..d8fa95b 100644 --- a/entities/differential.go +++ b/entities/differential.go @@ -8,23 +8,24 @@ import ( // DifferentialRevision represents a revision in Differential. type DifferentialRevision struct { - ID string `json:"id"` - PHID string `json:"phid"` - Title string `json:"title"` - URI string `json:"uri"` - DateCreated util.UnixTimestamp `json:"dateCreated"` - DateModified util.UnixTimestamp `json:"dateModified"` - AuthorPHID string `json:"authorPHID"` - Status string `json:"status"` - StatusName string `json:"statusName"` - Branch string `json:"branch"` - Summary string `json:"summary"` - TestPlan string `json:"testPlan"` - LineCount string `json:"lineCount"` - ActiveDiffPHID string `json:"activeDiffPHID"` - Diffs []string `json:"diffs"` - Commits []string `json:"commits"` - Reviewers map[string]string `json:"reviewers"` + ID string `json:"id"` + PHID string `json:"phid"` + Title string `json:"title"` + URI string `json:"uri"` + DateCreated util.UnixTimestamp `json:"dateCreated"` + DateModified util.UnixTimestamp `json:"dateModified"` + AuthorPHID string `json:"authorPHID"` + Status string `json:"status"` + StatusName string `json:"statusName"` + Branch string `json:"branch"` + Summary string `json:"summary"` + TestPlan string `json:"testPlan"` + LineCount string `json:"lineCount"` + ActiveDiffPHID string `json:"activeDiffPHID"` + Diffs []string `json:"diffs"` + Commits []string `json:"commits"` + // Reviewers is either of type map[string]string when populated, or []string when empty + Reviewers json.RawMessage `json:"reviewers"` CCs []string `json:"ccs"` Hashes [][]string `json:"hashes"` Auxiliary map[string]interface{} `json:"auxiliary"` @@ -47,9 +48,10 @@ type DifferentialDiff struct { UnitStatus string `json:"unitStatus"` LintStatus string `json:"lintStatus"` Changes []DifferentialChange `json:"changes"` - Properties json.RawMessage `json:"properties"` - AuthorName string `json:"authorName"` - AuthorEmail string `json:"authorEmail"` + // Properties is either of type *DifferentialProperties when populated, or []string when empty + Properties json.RawMessage `json:"properties"` + AuthorName string `json:"authorName"` + AuthorEmail string `json:"authorEmail"` } // A DifferentialChange represents a change to a file in Differential.