mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-25 21:25:20 +00:00
JSONSchema::generate_typetext: default_key support
This commit is contained in:
parent
2f9e609a46
commit
751ffbdd03
@ -1357,13 +1357,17 @@ sub generate_typetext {
|
|||||||
my ($pre, $post) = ('', '');
|
my ($pre, $post) = ('', '');
|
||||||
my $add = sub {
|
my $add = sub {
|
||||||
my ($key) = @_;
|
my ($key) = @_;
|
||||||
if (my $desc = $schema->{$key}->{format_description}) {
|
$typetext .= $pre;
|
||||||
$typetext .= "$pre$key=<$desc>$post";
|
my $entry = $schema->{$key};
|
||||||
} elsif (my $text = $schema->{$key}->{typetext}) {
|
if (my $desc = $entry->{format_description}) {
|
||||||
$typetext .= "$pre$text$post";
|
$typetext .= $entry->{default_key} ? "[$key=]" : "$key=";
|
||||||
|
$typetext .= "<$desc>";
|
||||||
|
} elsif (my $text = $entry->{typetext}) {
|
||||||
|
$typetext .= $text;
|
||||||
} else {
|
} else {
|
||||||
die "internal error: neither format_description nor typetext found";
|
die "internal error: neither format_description nor typetext found";
|
||||||
}
|
}
|
||||||
|
$typetext .= $post;
|
||||||
};
|
};
|
||||||
foreach my $key (@required) {
|
foreach my $key (@required) {
|
||||||
&$add($key);
|
&$add($key);
|
||||||
|
Loading…
Reference in New Issue
Block a user