[pve-devel] applied: [PATCH common] Make returning undef possible
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon May 13 09:01:16 CEST 2019
Am 5/10/19 um 12:42 PM schrieb Dominic Jäger:
> Returning undef as optional return value for API calls
> is now possible.
>
applied my local version of this, with a Co-d-b flag for you and
a improved commit subject message, thanks!
> Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
> ---
> src/PVE/CLIFormatter.pm | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm
> index e886db5..84dbed1 100644
> --- a/src/PVE/CLIFormatter.pm
> +++ b/src/PVE/CLIFormatter.pm
> @@ -413,6 +413,7 @@ sub print_api_result {
>
> if ($result_schema && defined($result_schema->{type})) {
> return if $result_schema->{type} eq 'null';
> + return if $result_schema->{optional} && !defined($data);
> } else {
> my $type = $guess_type->($data);
> $result_schema = { type => $type };
>
More information about the pve-devel
mailing list