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

Update Invoke-JiraIssueTransition.ps1 #417

Merged
merged 1 commit into from
May 19, 2020
Merged

Conversation

Rufus125
Copy link
Contributor

Increase the JSON transformation depth

Description

As can be seen by comparing the output of the last two commands, the "System.Collections.Hashtable" is not serialized and therefore the transition fails.

#create the fields object for a MultiGroupPicker/Multiselect/MultiUserPicker/VersionPicker field as can be found here: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#creating-an-issue-examples
$service = @(1)
$service_key_hashtable = @{key = 'JIRA-13961'}
$service[0] = $service_key_hashtable
$fields = @{customfield_12200 = $service}
ConvertTo-Json $fields #output just to compare it to the HTTP request
{
    "customfield_12200":  [
                              {
                                  "key":  "JIRA-13961"
                              }
                          ]
}

$newji = New-JiraIssue -Project "proj" -IssueType "Incident" -summary "summary"

$transition = $newji.Transition | where Name -eq "2nd level"

$resp = Invoke-JiraIssueTransition -Issue $newji -Transition $transition -Fields $fields -Verbose

ConvertTo-Json $requestBody -Depth 4
{
    "transition":  {
                       "id":  "113"
                   },
    "fields":  {
                   "assignee":  {
                                    "name":  null
                                }
               },
    "update":  {
                   "customfield_12200":  [
                                             {
                                                 "set":  [
                                                             "System.Collections.Hashtable"
                                                         ]
                                             }
                                         ]
               }
}

ConvertTo-Json $requestBody -Depth 5

{
    "transition":  {
                       "id":  "113"
                   },
    "fields":  {
                   "assignee":  {
                                    "name":  null
                                }
               },
    "update":  {
                   "customfield_12200":  [
                                             {
                                                 "set":  [
                                                             {
                                                                 "key":  "JIRA-13961"
                                                             }
                                                         ]
                                             }
                                         ]
               }
}

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have added Pester Tests that describe what my changes should do.
  • I have updated the documentation accordingly.

Increase the JSON transformation depth
@Rufus125 Rufus125 requested review from a team as code owners May 19, 2020 16:07
@lipkau lipkau merged commit 93b53a3 into AtlassianPS:master May 19, 2020
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.

2 participants