From: Wolfgang Bumiller Date: Wed, 2 Nov 2016 11:08:33 +0000 (+0100) Subject: JSONSchema: named formats in parse_property_string X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7c1617b01d1154d5056428c0a4a394845b0c3b40;hp=a9da67124dec914c9316ba224c1938af062d3e1b;p=pve-common.git JSONSchema: named formats in parse_property_string While our code currently passes the format hashes directly, some code gets them via the format property of a configuration description which verifies successfully via check_format() for named property string formats, so this should be allowed. --- diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm index debbbb5..961dfbe 100644 --- a/src/PVE/JSONSchema.pm +++ b/src/PVE/JSONSchema.pm @@ -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); + # 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 = {};