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

Issue.Search()'s Status field isn't being set #331

Open
tariqahmed opened this issue Dec 24, 2020 · 3 comments
Open

Issue.Search()'s Status field isn't being set #331

tariqahmed opened this issue Dec 24, 2020 · 3 comments
Labels
needs triage Ticket that needs triage (a proper look for classification)

Comments

@tariqahmed
Copy link

Describe the bug

Hey all,

I recently began learning Go and working on a little project w/Jira to learn, so this may be an issue with my knowledge.

The issue is that when I use the Issue.Search() function, the Fields.Status field/property comes back as nil.

Example:

u, _, err := client.Issue.Search("\"Epic Link\" = DOP-8", &searchOptions)
for _, issue := range u {
	fmt.Printf("Key:%s | Status:%+v | Summary: %+v\n", issue.Key, issue.Fields.Status, issue.Fields.Summary)
}
OUTPUT:
Key:DOP-16 | Status:<nil> | Summary: s8
Key:DOP-15 | Status:<nil> | Summary: s7
etc...

However if I get a single issue via the Issue.Get() function, Fields.Status is set and contains the status and status category of the issue.

for _, issue := range u {
   oneIssue, _, err := client.Issue.Get(issue.Key, nil)
   fmt.Printf("Status: %+v\n", oneIssue.Fields.Status)
}

OUTPUT:
Status: &{Self:https:/....atlassian.net/rest/api/2/status/10001 Description: IconURL:https://....atlassian.net/ Name:Done ID:10001 StatusCategory:{Self:https://....atlassian.net/rest/api/2/statuscategory/3 ID:3 Name:Done Key:done ColorName:green}}
Status: &{Self:https://....atlassian.net/rest/api/2/status/10001 Description: IconURL:https://....atlassian.net/ Name:Done ID:10001 StatusCategory:{Self:https://....atlassian.net/rest/api/2/statuscategory/3 ID:3 Name:Done Key:done ColorName:green}}

If I get proficient enough would be happy to contribute a fix, but not sure if the issue from Search is expected behavior, and if I'm missing something...

Thx.

@github-actions
Copy link

Hi! Thank you for taking the time to create your first issue! Really cool to see you here for the first time. Please give us a bit of time to review it.

@ghostsquad
Copy link
Contributor

It might be that Jira doesn't fill in all fields for issues when searching. You can see here: https://github.com/andygrunwald/go-jira/blob/master/issue.go?ts=4#L1036 that we are calling the rest/api/2/search endpoint of jira.

there's more information here:
https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issue-search/#api-rest-api-2-search-get

and

https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-get

it seems you must include expand as a url query parameter to ensure you get some fields included. This isn't currently supported with the existing methods though.

@andygrunwald andygrunwald added the needs triage Ticket that needs triage (a proper look for classification) label Aug 20, 2022
@andygrunwald
Copy link
Owner

Hey,

I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in #489

The development will take some time; however, I hope you can benefit from the changes.
If you seek priority development for your issue + you like to sponsor it, please contact me.

What does this mean for my issue?

We will work on this issue indirectly.
This means that during the development phase, we aim to tackle it.
Maybe in a different way like it is currently handled.
Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using this library.
If there is anything else you would like to tell us, let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Ticket that needs triage (a proper look for classification)
Projects
None yet
Development

No branches or pull requests

3 participants