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

[breaking] cli: format json always start with a json object #2407

Conversation

alessio-perugini
Copy link
Contributor

@alessio-perugini alessio-perugini commented Nov 7, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

We're wrapping in json object all the results that previously were emitting directly an array

What is the current behavior?

Currently, some commands when printing with json, are starting with an array instead of an object

What is the new behavior?

We uniformed every command to always output a json Object.

Does this PR introduce a breaking change, and is titled accordingly?

Other information

@alessio-perugini alessio-perugini linked an issue Nov 7, 2023 that may be closed by this pull request
3 tasks
@alessio-perugini alessio-perugini self-assigned this Nov 7, 2023
@alessio-perugini alessio-perugini added the topic: code Related to content of the project itself label Nov 7, 2023
@alessio-perugini alessio-perugini force-pushed the 2406-ensure-that-cli-json-output-always-return-a-jsonobject branch 3 times, most recently from f4aeca4 to 88f7058 Compare November 7, 2023 13:24
Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (ae24226) 67.23% compared to head (72a06b4) 67.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2407      +/-   ##
==========================================
- Coverage   67.23%   67.16%   -0.07%     
==========================================
  Files         210      210              
  Lines       20519    20523       +4     
==========================================
- Hits        13796    13785      -11     
- Misses       5589     5600      +11     
- Partials     1134     1138       +4     
Flag Coverage Δ
unit 67.16% <77.27%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
internal/cli/board/listall.go 57.44% <100.00%> (ø)
internal/cli/config/add.go 93.61% <100.00%> (ø)
internal/cli/config/set.go 85.36% <100.00%> (ø)
internal/cli/core/list.go 90.62% <100.00%> (ø)
internal/cli/lib/check_deps.go 76.81% <100.00%> (ø)
internal/cli/lib/examples.go 55.88% <100.00%> (ø)
internal/cli/lib/list.go 94.44% <100.00%> (ø)
internal/cli/config/dump.go 71.42% <50.00%> (ø)
internal/cli/core/search.go 74.75% <80.00%> (ø)
internal/cli/board/list.go 34.43% <60.00%> (ø)
... and 2 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alessio-perugini alessio-perugini changed the title Cli: format json always start with a json object [breaking] cli: format json always start with a json object Nov 7, 2023
@alessio-perugini alessio-perugini marked this pull request as ready for review November 7, 2023 14:02
@alessio-perugini alessio-perugini force-pushed the 2406-ensure-that-cli-json-output-always-return-a-jsonobject branch 3 times, most recently from d55f197 to 2261009 Compare November 10, 2023 08:18
@alessio-perugini alessio-perugini force-pushed the 2406-ensure-that-cli-json-output-always-return-a-jsonobject branch from 99b4798 to 0e1f3f2 Compare November 10, 2023 13:51
Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

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

image

@alessio-perugini alessio-perugini merged commit 10c1411 into master Nov 10, 2023
105 checks passed
@alessio-perugini alessio-perugini deleted the 2406-ensure-that-cli-json-output-always-return-a-jsonobject branch November 10, 2023 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure that cli JSON output always return a JsonObject
3 participants