]> git.proxmox.com Git - pve-common.git/commitdiff
fix doc generator (do not convert efidisk0 to efidisk[N])
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 29 Sep 2016 10:15:47 +0000 (12:15 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 29 Sep 2016 10:15:47 +0000 (12:15 +0200)
Also fix spacing in typetext generator.

src/PVE/JSONSchema.pm
src/PVE/RESTHandler.pm

index 021e4e0784413037b410e551d4f9d0c82b120c77..caeefe2c6b61a108f6dedfdc7972633080543cb2 100644 (file)
@@ -1678,10 +1678,10 @@ sub schema_get_type_text {
     } elsif ($type eq 'integer' || $type eq 'number') {
        # NOTE: always access values as number (avoid converion to string)
        if (defined($phash->{minimum}) && defined($phash->{maximum})) {
-           return "$type (" . ($phash->{minimum} + 0) . "-" .
+           return "$type (" . ($phash->{minimum} + 0) . " - " .
                ($phash->{maximum} + 0) . ")";
        } elsif (defined($phash->{minimum})) {
-           return "$type (" . ($phash->{minimum} + 0) . "- N)";
+           return "$type (" . ($phash->{minimum} + 0) . " - N)";
        } elsif (defined($phash->{maximum})) {
            return "$type (-N - " . ($phash->{maximum} + 0) . ")";
        }
index fc220a6018481d48bc2ab75b8aa39eb3728964b2..5e46dc3fb85097bb5c24193055a2aecf6aedf219 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
@@ -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]";
            }