Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update comment fields of struct type to be pointers to fix json … #695

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ominiet
Copy link

@ominiet ominiet commented Dec 30, 2024

…marshal for addcomment method on issue service

What type of PR is this?

  • bug

What this PR does / why we need it:

We have experienced issues using the AddCommentWithContext method with the following input:

jid := "ABC-123"
c := &jira.Comment{
  Body: "Some comment body",
}

cmntBytes, _ := json.Marshal(c)

cmnt, resp, err := jc.Issue.AddComment(context.Background(), jid, c)

I receive

Invalid request payload. Refer to the REST API documentation and try again.: request failed. Please analyze the request body for more details. Status code: 400

This likely happens because the marshalled output from json.Marshal comes up as

{
  "author": {
    "avatarUrls": {},
    "groups": {},
    "applicationRoles": {}
  }
  "body": "Some comment body",
  "updateAuthor": {
    "avatarUrls": {},
    "groups": {},
    "applicationRoles": {}
  },
  "visibility": {}
}

Which issue(s) this PR fixes:

Fixes #671

Special notes for your reviewer:

Additional documentation e.g., usage docs, etc.:

…marshal for addcomment method on issue service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding comments to issues won't work
1 participant