]> git.proxmox.com Git - pve-common.git/commitdiff
schema_get_type_text: render generic types as <type>
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 5 Nov 2016 14:38:29 +0000 (15:38 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 5 Nov 2016 14:38:29 +0000 (15:38 +0100)
src/PVE/JSONSchema.pm
src/PVE/RESTHandler.pm

index 961dfbeeeb9af737db161ff5c7a61347c9fccf61..fe6614ac57b86cae287c5757c169e01558fd73a6 100644 (file)
@@ -1683,18 +1683,18 @@ sub schema_get_type_text {
     } elsif ($phash->{format_description}) {
        return "<$phash->{format_description}>";
     } elsif ($phash->{enum}) {
     } 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})) {
     } 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})) {
                ($phash->{maximum} + 0) . ")";
        } 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') {
        if (my $format = $phash->{format}) {
        }
     } elsif ($type eq 'string') {
        if (my $format = $phash->{format}) {
@@ -1705,7 +1705,7 @@ sub schema_get_type_text {
        }
     }
 
        }
     }
 
-    return $type;
+    return "<$type>";
 }
 
 1;
 }
 
 1;
index 5e46dc3fb85097bb5c24193055a2aecf6aedf219..4b67c614f336c1fc52c1a70d0234847163aa6b95 100644 (file)
@@ -443,7 +443,7 @@ my $get_property_description = sub {
     if ($fileparams && $type eq 'string') {
        foreach my $elem (@$fileparams) {
            if ($name eq $elem) {
     if ($fileparams && $type eq 'string') {
        foreach my $elem (@$fileparams) {
            if ($name eq $elem) {
-               $type = 'filepath';
+               $type = '<filepath>';
                last;
            }
        }
                last;
            }
        }
@@ -466,7 +466,7 @@ my $get_property_description = sub {
        $res .= "`$type` " if $type;
 
        if (defined(my $dv = $phash->{default})) {
        $res .= "`$type` " if $type;
 
        if (defined(my $dv = $phash->{default})) {
-           $res .= "(default=`$dv`)";
+           $res .= "('default =' `$dv`)";
        }
 
        if ($style eq 'config-sub') {
        }
 
        if ($style eq 'config-sub') {