mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-09 05:17: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}) {
|
||||
return "<$phash->{format_description}>";
|
||||
} elsif ($phash->{enum}) {
|
||||
return "(" . join(' | ', sort @{$phash->{enum}}) . ")";
|
||||
return "<" . join(' | ', sort @{$phash->{enum}}) . ">";
|
||||
} elsif ($phash->{pattern}) {
|
||||
return $phash->{pattern};
|
||||
} 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) . ")";
|
||||
return "<$type> (-N - " . ($phash->{maximum} + 0) . ")";
|
||||
}
|
||||
} elsif ($type eq 'string') {
|
||||
if (my $format = $phash->{format}) {
|
||||
@ -1705,7 +1705,7 @@ sub schema_get_type_text {
|
||||
}
|
||||
}
|
||||
|
||||
return $type;
|
||||
return "<$type>";
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -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') {
|
||||
|
Loading…
Reference in New Issue
Block a user