TL;DR
A command like hcloud volume list --output json currently outputs null if no volumes were found.
Expected behavior
When a list command in JSON mode has nothing to list, the output should be [], so that the "nothing was found" case is identical to the "things were found" case in terms of how to process the data.
YAML mode actually handles this correctly, interestingly.
Observed behavior
List commands in JSON mode output null when they have nothing to list. This means that consumers of that data have to write extra code dedicated purely to handling null. If it's rare that someone's code encounters empty output from one of the list commands, it's even possible that this could blow up on someone in production.
Because consumers already have to handle the case where the output is an array, this will be a non-breaking change (except for anyone who made the unreasonable assumption that arrays will always have at least 1 entry).
Minimal working example
This assumes a project that contains no volumes:
hcloud volume list --output json
Log output
Additional information
This is with hcloud 1.52.0
TL;DR
A command like
hcloud volume list --output jsoncurrently outputsnullif no volumes were found.Expected behavior
When a list command in JSON mode has nothing to list, the output should be
[], so that the "nothing was found" case is identical to the "things were found" case in terms of how to process the data.YAML mode actually handles this correctly, interestingly.
Observed behavior
List commands in JSON mode output
nullwhen they have nothing to list. This means that consumers of that data have to write extra code dedicated purely to handlingnull. If it's rare that someone's code encounters empty output from one of the list commands, it's even possible that this could blow up on someone in production.Because consumers already have to handle the case where the output is an array, this will be a non-breaking change (except for anyone who made the unreasonable assumption that arrays will always have at least 1 entry).
Minimal working example
This assumes a project that contains no volumes:
Log output
Additional information
This is with hcloud 1.52.0