Open
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the assignIssue function to enable handling the special case where the accountID "null" triggers unassignment by sending a JSON null payload.
- Introduces conditional payload formation based on the accountID value.
- Includes a TODO note for future support of a direct nil value.
fank
commented
Apr 22, 2025
Comment on lines
+150
to
+153
| if accountID == "null" { | ||
| // Special case: if "null" is passed, send a JSON null value to unassign the issue | ||
| // TODO: allow the user to pass a nil value in next major version | ||
| payload = map[string]interface{}{"accountId": nil} |
Collaborator
Author
There was a problem hiding this comment.
Other possibility
Suggested change
| if accountID == "null" { | |
| // Special case: if "null" is passed, send a JSON null value to unassign the issue | |
| // TODO: allow the user to pass a nil value in next major version | |
| payload = map[string]interface{}{"accountId": nil} | |
| if accountID == "" { | |
| // Special case: if an empty string is passed, send a JSON null value to unassign the issue | |
| // TODO: allow the user to pass a nil value in next major version | |
| payload = map[string]interface{}{"accountId": nil} |
There was a problem hiding this comment.
@fank I think if there's a special value it can be null as you've suggested, or something more explicit and context-specific along the lines of unassigned.
I'm also okay with an empty string, however I think that would need a bit stronger, clearer language in the documentation to reflect that behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a change to the
assignIssuefunction injira/internal/issue_impl.goto handle a special case for unassigning issues. The key update ensures that passing the string"null"as theaccountIDresults in sending a JSONnullvalue in the request payload, improving the clarity and functionality of the API.Key change:
jira/internal/issue_impl.go: Updated theassignIssuefunction to handle the special case where"null"is passed as theaccountID. This now sends a JSONnullvalue in the payload to unassign the issue, with a note to allow passing anilvalue in the next major version.Fixes #355