From: Dietmar Maurer Date: Thu, 29 Sep 2016 10:15:47 +0000 (+0200) Subject: fix doc generator (do not convert efidisk0 to efidisk[N]) X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=b54ad320a5165dddc28272279d34183a6533928c;ds=sidebyside fix doc generator (do not convert efidisk0 to efidisk[N]) Also fix spacing in typetext generator. --- diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 021e4e0..caeefe2 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -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) . ")"; } diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index fc220a6..5e46dc3 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -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]"; }