]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/JSONSchema.pm
JSONSchema: named formats in parse_property_string
[pve-common.git] / src / PVE / JSONSchema.pm
index debbbb5904004936e4553217fecc3f363db14a05..961dfbeeeb9af737db161ff5c7a61347c9fccf61 100644 (file)
@@ -506,6 +506,17 @@ sub parse_property_string {
     # In property strings we default to not allowing additional properties
     $additional_properties = 0 if !defined($additional_properties);
 
     # In property strings we default to not allowing additional properties
     $additional_properties = 0 if !defined($additional_properties);
 
+    # Support named formats here, too:
+    if (!ref($format)) {
+       if (my $desc = $format_list->{$format}) {
+           $format = $desc;
+       } else {
+           die "unknown format: $format\n";
+       }
+    } elsif (ref($format) ne 'HASH') {
+       die "unexpected format value of type ".ref($format)."\n";
+    }
+
     my $default_key;
 
     my $res = {};
     my $default_key;
 
     my $res = {};