From 25d9bda94127b1a91181cd80bb9948093dea389b Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 5 Nov 2016 15:38:29 +0100 Subject: [PATCH] schema_get_type_text: render generic types as --- src/PVE/JSONSchema.pm | 10 +++++----- src/PVE/RESTHandler.pm | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index 961dfbe..fe6614a 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -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; diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index 5e46dc3..4b67c61 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -443,7 +443,7 @@ my $get_property_description = sub { if ($fileparams && $type eq 'string') { foreach my $elem (@$fileparams) { if ($name eq $elem) { - $type = 'filepath'; + $type = ''; last; } } @@ -466,7 +466,7 @@ my $get_property_description = sub { $res .= "`$type` " if $type; if (defined(my $dv = $phash->{default})) { - $res .= "(default=`$dv`)"; + $res .= "('default =' `$dv`)"; } if ($style eq 'config-sub') { -- 2.39.2