]> git.proxmox.com Git - pve-common.git/commitdiff
schema_get_type_text: always access values as number
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Sep 2016 07:27:50 +0000 (09:27 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 5 Sep 2016 07:27:50 +0000 (09:27 +0200)
Else PVE::RESTHandler::api_dump prints values as strings.

src/PVE/JSONSchema.pm

index b53736e4c63b0ec9975e2b385defcb71229e8597..021e4e0784413037b410e551d4f9d0c82b120c77 100644 (file)
@@ -1676,12 +1676,14 @@ sub schema_get_type_text {
     } 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} - $phash->{maximum})";
+           return "$type (" . ($phash->{minimum} + 0) . "-" .
+               ($phash->{maximum} + 0) . ")";
        } elsif (defined($phash->{minimum})) {
-           return "$type ($phash->{minimum} - N)";
+           return "$type (" . ($phash->{minimum} + 0) . "- N)";
        } elsif (defined($phash->{maximum})) {
-           return "$type (-N - $phash->{maximum})";
+           return "$type (-N - " . ($phash->{maximum} + 0) . ")";
        }
     } elsif ($type eq 'string') {
        if (my $format = $phash->{format}) {