From 05185ea25a0fabbd5a7071aa13c9b61de8f73861 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 5 Sep 2016 09:27:50 +0200 Subject: [PATCH] schema_get_type_text: always access values as number Else PVE::RESTHandler::api_dump prints values as strings. --- src/PVE/JSONSchema.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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}) { -- 2.39.2