Closed maboehm closed 1 year ago
Hi, -o json
is now outputting items
since v6.6.1. the rest of the keys being lost is a bit more work. it's due to the duplicated print funcs which would take a bit more work to fix. i'd rather not close the issue yet until these are fixed
Will be fixed by #348
-o json
% i dc ls -o json | jq keys
[
"_links",
"href",
"id",
"items",
"limit",
"offset",
"type"
]
You can expect this to be included in the next release!
Description
The JSON output generated by addding the flag
-o json
to any command is different from the output produced when calling an endpoint directly. E.g.I don't necessarily mind that the metadata is lost, but the fact that the top level key
items
gets renamed toResources
is very inconvenient - e.g. I would have expected that ajq
query works the same whether I use the API directly orionosctl -o json
Expected behavior
JSON fields in the API Response are not renamed
Environment
Ionosctl version:
References
This is caused by the way resulting lists are passed to the Printer, which specifies the JSON representation to be
Resources
https://github.com/ionos-cloud/ionosctl/blob/master/pkg/printer/result.go#L132