From f7ea942ed3458fa1c18753dbfff8dd8ad3f3909c Mon Sep 17 00:00:00 2001 From: Ignasi Fosch Date: Fri, 8 Jul 2016 01:21:14 +0200 Subject: [PATCH] Comments unmarshaling fixed --- issue.go | 7 ++++++- issue_test.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/issue.go b/issue.go index 3513cbd..3024adc 100644 --- a/issue.go +++ b/issue.go @@ -78,7 +78,7 @@ type IssueFields struct { AggregateProgress *Progress `json:"aggregateprogress,omitempty"` Worklog *Worklog `json:"worklog,omitempty"` IssueLinks []*IssueLink `json:"issuelinks,omitempty"` - Comments []*Comment `json:"comment.comments,omitempty"` + Comments *Comments `json:"comment,omitempty"` FixVersions []*FixVersion `json:"fixVersions,omitempty"` Labels []string `json:"labels,omitempty"` Subtasks []*Subtasks `json:"subtasks,omitempty"` @@ -245,6 +245,11 @@ type IssueLinkType struct { Outward string `json:"outward"` } +// Comments represents a list of Comment. +type Comments struct { + Comments []*Comment `json:"comments,omitempty"` +} + // Comment represents a comment by a person to an issue in JIRA. type Comment struct { ID string `json:"id,omitempty"` diff --git a/issue_test.go b/issue_test.go index 37c2d98..b498f8d 100644 --- a/issue_test.go +++ b/issue_test.go @@ -138,6 +138,10 @@ func TestIssueFields(t *testing.T) { t.Error("Expected labels for the returned issue") } + if len(issue.Fields.Comments.Comments) != 1 { + t.Errorf("Expected one comment, %v found", len(issue.Fields.Comments.Comments)) + } + if err != nil { t.Errorf("Error given: %s", err) }