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

feat(718): issue view: raw response option #720

Merged
merged 1 commit into from Apr 6, 2024

Conversation

mpalahuta
Copy link
Contributor

#718

Adding --json flag to the jira issue view <KEY> command so that the tool prints the issue contents as plain JSON if the flag is set. This feature allows users to process the issue information with their programs to support various automation scenarios.

I've added an intermediate struct printableIssue to ensure correct null/empty values in the produced JSON, to avoid zero-values like

{
...
  "assignee": {
    "displayName": ""
  }
...
}

Screenshot 2024-03-14 at 16 29 36

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mpalahuta, Thank you for working on this.

I was bit hesitant to support json response but since there are lot of requests for this (and now a PR), I am reconsidering my decision.

Having said that, if we want to go ahead with json response, I think we should send the entire raw json response from the API to the user. That would help us cover most of the usecase reported.

Let me know what you think!

internal/view/issue.go Outdated Show resolved Hide resolved
@mpalahuta
Copy link
Contributor Author

Hey @ankitpokhrel
Thanks a lot for looking into this PR and for the green light on the JSON output - this will be very helpful!

Reg. raw response, sounds great, thanks! I will update this PR on Mon to do exactly that!

@mpalahuta mpalahuta changed the title feat(718): view issue: json output option feat(718): issue view: raw response option Mar 19, 2024
@mpalahuta
Copy link
Contributor Author

hey @ankitpokhrel
I've updated the PR to follow your suggestion of printing the raw API response. Verified on my machine - works as expected.
Please take a look whenever you have a chance, thanks!

Screenshot 2024-03-19 at 18 01 24

@valters
Copy link

valters commented Mar 28, 2024

hi @ankitpokhrel, I am also interested in this improvement. Having this will enable new build/release automation scenarios for us.

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you 🎉

flagRaw = "raw"
flagDebug = "debug"
flagComments = "comments"
flagPlain = "plain"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for refactoring this 👍🏻

@ankitpokhrel ankitpokhrel merged commit 53a3d56 into ankitpokhrel:main Apr 6, 2024
4 checks passed
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.

None yet

4 participants