Azure / Azure/azure-sdk-tools

AZSDK CLI `-o json` does not work as expected... or stated

Open
#15,529 0 comments 0 reactions 0 assignees View on GitHub
azsdk-cli
Dominant language
C#
Stars
135
Forks
260
Avg merge
3d 1h
Merged PRs (30d)
143

Description

### Problem

The `-o` option for the azsdk CLI says:

`-o, --output The format of the output. Supported formats are: plain, json [default: plain]`

However, when I run this on a command that RETURNS JSON, I do not get a JSON output, I get this...

```json
{
"message": null,
"result": ,
"language": null,
"package_name": null,
"operation_status": "Succeeded"
}
```

This is NOT the JSON representation of my command output. It is a JSON representation of some Response-type object and my actual command output is still represented as plain text!!!

### Suggest Fix

Either we should

1. Add a `-o response` option that returns the current payload as-is and make `-o json` actually return the result as JSON OR

2. The command still returns this weird response object but ALSO returns the result as JSON.

My preference would be for option 1.

Contributor guide

Open the contributing guide

Research direction

Start at the azsdk CLI's -o/--output handling and reproduce the behavior with a command that returns JSON. No file or test is named in the issue, so trace the output path before deciding whether the documented json format should serialize the command result or expose the current response payload. Done means the selected output contract is implemented and covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.