]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/RESTHandler.pm
schema_get_type_text: render generic types as <type>
[pve-common.git] / src / PVE / RESTHandler.pm
index fc220a6018481d48bc2ab75b8aa39eb3728964b2..4b67c614f336c1fc52c1a70d0234847163aa6b95 100644 (file)
@@ -34,7 +34,7 @@ sub api_clone_schema {
            my $pd = $d->{$p};
            if ($p =~ m/^([a-z]+)(\d+)$/) {
                my ($name, $idx) = ($1, $2);
-               if ($idx == 0) {
+               if ($idx == 0 && defined($d->{"${name}1"})) {
                    $p = "${name}[n]";
                } elsif (defined($d->{"${name}0"})) {
                    next; # only handle once for -xx0, but only if -xx0 exists
@@ -443,7 +443,7 @@ my $get_property_description = sub {
     if ($fileparams && $type eq 'string') {
        foreach my $elem (@$fileparams) {
            if ($name eq $elem) {
-               $type = 'filepath';
+               $type = '<filepath>';
                last;
            }
        }
@@ -466,7 +466,7 @@ my $get_property_description = sub {
        $res .= "`$type` " if $type;
 
        if (defined(my $dv = $phash->{default})) {
-           $res .= "(default=`$dv`)";
+           $res .= "('default =' `$dv`)";
        }
 
        if ($style eq 'config-sub') {
@@ -591,7 +591,7 @@ sub usage_str {
        if ($k =~ m/^([a-z]+)(\d+)$/) {
            my ($name, $idx) = ($1, $2);
            next if $idx_param->{$name};
-           if ($idx == 0) {
+           if ($idx == 0 && defined($prop->{"${name}1"})) {
                $idx_param->{$name} = 1;
                $base = "${name}[n]";
            }
@@ -656,7 +656,7 @@ sub dump_properties {
        if ($k =~ m/^([a-z]+)(\d+)$/) {
            my ($name, $idx) = ($1, $2);
            next if $idx_param->{$name};
-           if ($idx == 0) {
+           if ($idx == 0 && defined($prop->{"${name}1"})) {
                $idx_param->{$name} = 1;
                $base = "${name}[n]";
            }