From 75d2ddc71efc410c1cc3699ff1af6e308672a435 Mon Sep 17 00:00:00 2001 From: Oscar Miniet Date: Mon, 30 Dec 2024 15:36:13 -0500 Subject: [PATCH] fix: update comment fields of struct type to be pointers to fix json marshal for addcomment method on issue service --- cloud/issue.go | 18 +++++++++--------- cloud/issue_test.go | 6 +++--- onpremise/issue.go | 18 +++++++++--------- onpremise/issue_test.go | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cloud/issue.go b/cloud/issue.go index 91e65074..098c4750 100644 --- a/cloud/issue.go +++ b/cloud/issue.go @@ -472,15 +472,15 @@ type Comments struct { // Comment represents a comment by a person to an issue in Jira. type Comment struct { - ID string `json:"id,omitempty" structs:"id,omitempty"` - Self string `json:"self,omitempty" structs:"self,omitempty"` - Name string `json:"name,omitempty" structs:"name,omitempty"` - Author User `json:"author,omitempty" structs:"author,omitempty"` - Body string `json:"body,omitempty" structs:"body,omitempty"` - UpdateAuthor User `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"` - Updated string `json:"updated,omitempty" structs:"updated,omitempty"` - Created string `json:"created,omitempty" structs:"created,omitempty"` - Visibility CommentVisibility `json:"visibility,omitempty" structs:"visibility,omitempty"` + ID string `json:"id,omitempty" structs:"id,omitempty"` + Self string `json:"self,omitempty" structs:"self,omitempty"` + Name string `json:"name,omitempty" structs:"name,omitempty"` + Author *User `json:"author,omitempty" structs:"author,omitempty"` + Body string `json:"body,omitempty" structs:"body,omitempty"` + UpdateAuthor *User `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"` + Updated string `json:"updated,omitempty" structs:"updated,omitempty"` + Created string `json:"created,omitempty" structs:"created,omitempty"` + Visibility *CommentVisibility `json:"visibility,omitempty" structs:"visibility,omitempty"` // A list of comment properties. Optional on create and update. Properties []EntityProperty `json:"properties,omitempty" structs:"properties,omitempty"` diff --git a/cloud/issue_test.go b/cloud/issue_test.go index 630aed77..09d83578 100644 --- a/cloud/issue_test.go +++ b/cloud/issue_test.go @@ -191,7 +191,7 @@ func TestIssueService_AddComment(t *testing.T) { c := &Comment{ Body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", - Visibility: CommentVisibility{ + Visibility: &CommentVisibility{ Type: "role", Value: "Administrators", }, @@ -219,7 +219,7 @@ func TestIssueService_UpdateComment(t *testing.T) { c := &Comment{ ID: "10001", Body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", - Visibility: CommentVisibility{ + Visibility: &CommentVisibility{ Type: "role", Value: "Administrators", }, @@ -316,7 +316,7 @@ func TestIssueService_AddLink(t *testing.T) { }, Comment: &Comment{ Body: "Linked related issue!", - Visibility: CommentVisibility{ + Visibility: &CommentVisibility{ Type: "group", Value: "jira-software-users", }, diff --git a/onpremise/issue.go b/onpremise/issue.go index d1bca7aa..084fa98f 100644 --- a/onpremise/issue.go +++ b/onpremise/issue.go @@ -471,15 +471,15 @@ type Comments struct { // Comment represents a comment by a person to an issue in Jira. type Comment struct { - ID string `json:"id,omitempty" structs:"id,omitempty"` - Self string `json:"self,omitempty" structs:"self,omitempty"` - Name string `json:"name,omitempty" structs:"name,omitempty"` - Author User `json:"author,omitempty" structs:"author,omitempty"` - Body string `json:"body,omitempty" structs:"body,omitempty"` - UpdateAuthor User `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"` - Updated string `json:"updated,omitempty" structs:"updated,omitempty"` - Created string `json:"created,omitempty" structs:"created,omitempty"` - Visibility CommentVisibility `json:"visibility,omitempty" structs:"visibility,omitempty"` + ID string `json:"id,omitempty" structs:"id,omitempty"` + Self string `json:"self,omitempty" structs:"self,omitempty"` + Name string `json:"name,omitempty" structs:"name,omitempty"` + Author *User `json:"author,omitempty" structs:"author,omitempty"` + Body string `json:"body,omitempty" structs:"body,omitempty"` + UpdateAuthor *User `json:"updateAuthor,omitempty" structs:"updateAuthor,omitempty"` + Updated string `json:"updated,omitempty" structs:"updated,omitempty"` + Created string `json:"created,omitempty" structs:"created,omitempty"` + Visibility *CommentVisibility `json:"visibility,omitempty" structs:"visibility,omitempty"` // A list of comment properties. Optional on create and update. Properties []EntityProperty `json:"properties,omitempty" structs:"properties,omitempty"` diff --git a/onpremise/issue_test.go b/onpremise/issue_test.go index 36b6aa31..d6f033ce 100644 --- a/onpremise/issue_test.go +++ b/onpremise/issue_test.go @@ -191,7 +191,7 @@ func TestIssueService_AddComment(t *testing.T) { c := &Comment{ Body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", - Visibility: CommentVisibility{ + Visibility: &CommentVisibility{ Type: "role", Value: "Administrators", }, @@ -219,7 +219,7 @@ func TestIssueService_UpdateComment(t *testing.T) { c := &Comment{ ID: "10001", Body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.", - Visibility: CommentVisibility{ + Visibility: &CommentVisibility{ Type: "role", Value: "Administrators", }, @@ -316,7 +316,7 @@ func TestIssueService_AddLink(t *testing.T) { }, Comment: &Comment{ Body: "Linked related issue!", - Visibility: CommentVisibility{ + Visibility: &CommentVisibility{ Type: "group", Value: "jira-software-users", },