From: Dietmar Maurer Date: Mon, 5 Sep 2016 07:27:50 +0000 (+0200) Subject: schema_get_type_text: always access values as number X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=05185ea25a0fabbd5a7071aa13c9b61de8f73861 schema_get_type_text: always access values as number Else PVE::RESTHandler::api_dump prints values as strings. --- diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index b53736e..021e4e0 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -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}) {