mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-24 14:03:35 +03:00
schema_get_type_text: render generic types as <type>
This commit is contained in:
parent
a007a5bc4b
commit
25d9bda941
@ -1683,18 +1683,18 @@ sub schema_get_type_text {
|
|||||||
} elsif ($phash->{format_description}) {
|
} elsif ($phash->{format_description}) {
|
||||||
return "<$phash->{format_description}>";
|
return "<$phash->{format_description}>";
|
||||||
} elsif ($phash->{enum}) {
|
} elsif ($phash->{enum}) {
|
||||||
return "(" . join(' | ', sort @{$phash->{enum}}) . ")";
|
return "<" . join(' | ', sort @{$phash->{enum}}) . ">";
|
||||||
} elsif ($phash->{pattern}) {
|
} elsif ($phash->{pattern}) {
|
||||||
return $phash->{pattern};
|
return $phash->{pattern};
|
||||||
} elsif ($type eq 'integer' || $type eq 'number') {
|
} elsif ($type eq 'integer' || $type eq 'number') {
|
||||||
# NOTE: always access values as number (avoid converion to string)
|
# NOTE: always access values as number (avoid converion to string)
|
||||||
if (defined($phash->{minimum}) && defined($phash->{maximum})) {
|
if (defined($phash->{minimum}) && defined($phash->{maximum})) {
|
||||||
return "$type (" . ($phash->{minimum} + 0) . " - " .
|
return "<$type> (" . ($phash->{minimum} + 0) . " - " .
|
||||||
($phash->{maximum} + 0) . ")";
|
($phash->{maximum} + 0) . ")";
|
||||||
} elsif (defined($phash->{minimum})) {
|
} elsif (defined($phash->{minimum})) {
|
||||||
return "$type (" . ($phash->{minimum} + 0) . " - N)";
|
return "<$type> (" . ($phash->{minimum} + 0) . " - N)";
|
||||||
} elsif (defined($phash->{maximum})) {
|
} elsif (defined($phash->{maximum})) {
|
||||||
return "$type (-N - " . ($phash->{maximum} + 0) . ")";
|
return "<$type> (-N - " . ($phash->{maximum} + 0) . ")";
|
||||||
}
|
}
|
||||||
} elsif ($type eq 'string') {
|
} elsif ($type eq 'string') {
|
||||||
if (my $format = $phash->{format}) {
|
if (my $format = $phash->{format}) {
|
||||||
@ -1705,7 +1705,7 @@ sub schema_get_type_text {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $type;
|
return "<$type>";
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -443,7 +443,7 @@ my $get_property_description = sub {
|
|||||||
if ($fileparams && $type eq 'string') {
|
if ($fileparams && $type eq 'string') {
|
||||||
foreach my $elem (@$fileparams) {
|
foreach my $elem (@$fileparams) {
|
||||||
if ($name eq $elem) {
|
if ($name eq $elem) {
|
||||||
$type = 'filepath';
|
$type = '<filepath>';
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ my $get_property_description = sub {
|
|||||||
$res .= "`$type` " if $type;
|
$res .= "`$type` " if $type;
|
||||||
|
|
||||||
if (defined(my $dv = $phash->{default})) {
|
if (defined(my $dv = $phash->{default})) {
|
||||||
$res .= "(default=`$dv`)";
|
$res .= "('default =' `$dv`)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($style eq 'config-sub') {
|
if ($style eq 'config-sub') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user