andygrunwald / go-jira

Go client library for Atlassian Jira
https://pkg.go.dev/github.com/andygrunwald/go-jira?tab=doc
MIT License
1.44k stars 458 forks source link

Creating issue with go-jira/v2/cloud failed with status code 400 #628

Open wlmost opened 1 year ago

wlmost commented 1 year ago

It is the same error from another issue. If I create an issue like issue := jira.Issue{ Fields: &jira.IssueFields{ Reporter: &jira.User{AccountID: jiraUser.AccountId}, Assignee: &jira.User{AccountID: jiraUser.AccountId}, Project: jira.Project{Key: "ESO"}, Type: jira.IssueType{Name: "Task"}, Priority: &jira.Priority{Name: "Niedrig"}, Summary: issueRequest.Summary, Description: issueRequest.Description, }, }

I get following error request failed. Please analyze the request body for more details. Status code: 400 Some debug output shows me that in the assignee and reporter field the attribute Password pop's up, like that 2023/05/31 11:12:57 [DEBUG CreateJiraIssue]: issue {"fields":{"assignee":{"Password":"","accountId":"an account id"},"issuetype":{"name":"Task"},"priority":{"name":"Niedrig"},"project":{"key":"ESO"},"reporter":{"Password":"","accountId":"an account id"},"summary":"A summary"}}

In the source of user.go the password field is missing omitempty in json. I believe that's the bug. Could check please?

tmwpwo commented 1 year ago

There is a way around that issue I found here: https://dev.to/iqquee/automate-jira-with-golang-i6c

andygrunwald commented 1 year ago

Thanks @wlmost for the bug report. I am currently short on time for open-source contributions due to other/private obligations. If you are able to fix it, I am happy to review a pull request. Thanks for contributing to open source (also via this issue!) and thanks for understanding.