get_options: allow no arguments if all are optional
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Sep 2020 07:59:01 +0000 (09:59 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Sep 2020 07:59:07 +0000 (09:59 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/JSONSchema.pm

index 2ceb1bd7aaac47019d1929a98706d487ab86ce46..e8d7395a858619a13668d5a570671f57198803a7 100644 (file)
@@ -1644,7 +1644,7 @@ sub get_options {
            foreach my $arg_name (@$arg_param) {
                if ($arg_name eq 'extra-args') {
                    $opts->{'extra-args'} = [];
-               } else {
+               } elsif (!$schema->{properties}->{$arg_name}->{optional}) {
                    raise("not enough arguments\n", code => HTTP_BAD_REQUEST);
                }
            }