andygrunwald / go-jira

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

FieldsValue need more types to be accepted #647

Open pmmalinov01 opened 11 months ago

pmmalinov01 commented 11 months ago

What happened?

I am trying to create an issue in ServiceDesk that is set up on-premise. Am getting a an error of:

{"time":"2023-10-23T16:28:52.746847979+03:00","level":"INFO","msg":"request failed. Please analyze the request body for more details. Status code: 400"}

I am may be going wrong about it but I am see in a manual approach a ticket I created from the UI and using curl/firefox to see the ticket I see:

{
          "fieldId": "customfield_29695",
          "label": "Jira project",
          "value": {
            "self": "https://jira.REDACTED.net/jira/rest/api/2/project/16910",
            "id": "16910",
            "key": "AT",
            "name": "Foo Bar Paz",
            "projectTypeKey": "service_desk",
            "avatarUrls": {
              "48x48": "https://jira.REDACTED.net/jira/secure/projectavatar?pid=16910&avatarId=25003",
              "24x24": "https://jira.REDACTED.net/jira/secure/projectavatar?size=small&pid=16910&avatarId=25003",
              "16x16": "https://jira.REDACTED.net/jira/secure/projectavatar?size=xsmall&pid=16910&avatarId=25003",
              "32x32": "https://jira.REDACTED.net/jira/secure/projectavatar?size=medium&pid=16910&avatarId=25003"
            },
            "projectCategory": {
              "self": "https://jira.REDACTED.net/jira/rest/api/2/projectCategory/10730",
              "id": "10730",
              "description": "",
              "name": "REDACTED"
            }
          }

to me, it seems that the value used in the []jira.RequestFieldValue allow only string https://github.com/andygrunwald/go-jira/blob/2e11dffbdb9a4710fdc9233e8efe0a124e204e24/onpremise/request.go#L29 May changing this to empty interface or any we can allow any value to be passed

What did you expect to happen?

A ticket to be created successfully

How can we reproduce it (as minimally and precisely as possible)?

try to create a task in ServiceDesk

Minimal code helps us to identify the problem faster. This depends on your jira used for testing/development. To be able to reproduce it you need field that accepts a bit more comple than a string

Anything else we need to know?

Your Environment

Include as many relevant details about the environment you experienced the problem in