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

Ensure that cli JSON output always return a JsonObject #2406

Closed
3 tasks done
alessio-perugini opened this issue Nov 6, 2023 · 0 comments · Fixed by #2407
Closed
3 tasks done

Ensure that cli JSON output always return a JsonObject #2406

alessio-perugini opened this issue Nov 6, 2023 · 0 comments · Fixed by #2407
Assignees
Labels
type: enhancement Proposed improvement

Comments

@alessio-perugini
Copy link
Contributor

Describe the request

Right now there are some commands like arduino-cli core list --format json that return an array of objects.
When a cli command is requested with the --format json, we want to enforce the output to start with a JSON object.
This also helps when we need to add some warning information in the JSON output, and it would simply add a warnings key in the object avoiding inconsistent behavior or some fatal edge cases.

We should also double-check if there are some commands that should return some json object but it currently doesn't return anything.

Expectation:
The result key can have also a different name. Something to be decided during the implementation.

arduino-cli core list --format json
{
  "result":[{...},...,{...}]
}

Describe the current behavior

Currently some commands like arduino-cli core list --format json print an array of objects

[
{...},
{...}
]

Arduino CLI version

Operating system

Linux

Operating system version

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details
@alessio-perugini alessio-perugini added the type: enhancement Proposed improvement label Nov 6, 2023
@alessio-perugini alessio-perugini self-assigned this Nov 6, 2023
@alessio-perugini alessio-perugini changed the title Ensure that cliJ SON output always return a JsonObject Ensure that cli JSON output always return a JsonObject Nov 7, 2023
@alessio-perugini alessio-perugini linked a pull request Nov 7, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant