]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/JSONSchema.pm
schema_get_type_text: render generic types as <type>
[pve-common.git] / src / PVE / JSONSchema.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}) {
-       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;