Skip to content

Unable to "expand" schema in new JQL issue search endpoint #404

@tjbarker

Description

@tjbarker

go-atlassian version
2.7

go-atlassian component

  • Jira Software Cloud
  • Jira Agile Cloud
  • Jira Service Management Cloud
  • Confluence Cloud
  • Atlassian Admin Cloud

Describe the bug 🐛
When fetching issues through the new JQL search (jira.SearchRicTextConnector.SearchJQL)
If you "expand" schema you receive the following error:
"cannot unmarshal object into Go struct field IssueSearchJQLSchemeV2.schema of type string"

In that object, schema is typed as map[string]string however, when i manually fetch from the API, i get schema as

    "schema": {
        "summary": {
            "type": "string",
            "system": "summary"
        },
        "assignee": {
            "type": "user",
            "system": "assignee"
        },
        "status": {
            "type": "status",
            "system": "status"
        }
    },

I'm unsure if all fields will have type and system as attributes, so don't know if they should be typed in,
but it looks as though the schema type should at least be map[string]interface{}

If I remove "schema" from the expand fields, the search works.

To Reproduce 🚧
Fetch issues from new v3 JQL endpoint,
Ensure you fetch with "expand" schema"

Expected behavior
Expect return of issues data with expanded fields.

Screenshots 📄
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Code snippet

package main

import (
	"context"
	"github.com/ctreminiom/go-atlassian/jira"
	"log"
	"os"
)

func main() {

	var (
		host  = os.Getenv("HOST")
		mail  = os.Getenv("MAIL")
		token = os.Getenv("TOKEN")
	)

	jiraCloud, err := jira.New(nil, host)
	if err != nil {
		return
	}

	jiraCloud.Auth.SetBasicAuth(mail, token)
	jiraCloud.Auth.SetUserAgent("curl/7.54.0")

	jql := "project = \"PT\""
	fields := []string{"summary", "status", "assignee"})
	expand := []string{"schema"}

	resp, _, error := jiraCloud.Issue.Search.SearchJQL(context.TODO(), jql, fields, expand, 10, "")

	if error != nil {
		log.Println("ERROR: ", error)
	}

}

Thanks! I'm happy to submit a change but unsure what type to set schema to

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions