[pve-devel] [PATCH pve-common 2/6] generate_typetext: better handling of only-optional cases

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Sep 22 13:45:40 CEST 2015


---
 src/PVE/JSONSchema.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index f36ee42..45ce5ba 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -1317,11 +1317,11 @@ sub generate_typetext {
 	&$add($key);
 	$pre = ', ';
     }
-    $pre = ' [,' if $pre;
+    $pre = $pre ? ' [,' : '[';
+    $post = ']';
     foreach my $key (@optional) {
 	&$add($key);
 	$pre = ' [,';
-	$post = ']';
     }
     return $typetext;
 }
-- 
2.1.4





More information about the pve-devel mailing list