]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/JSONSchema.pm
fix #4778: fix boolean type check for json parameters over the api
[pve-common.git] / src / PVE / JSONSchema.pm
index 85d47f23ee7aabd08ce585331ab1434214bbff6e..60b02cb19eefb0759999306e4fbe638ea55e270d 100644 (file)
@@ -10,6 +10,7 @@ use Devel::Cycle -quiet; # todo: remove?
 use PVE::Tools qw(split_list $IPV6RE $IPV4RE);
 use PVE::Exception qw(raise);
 use HTTP::Status qw(:constants);
+use JSON;
 use Net::IP qw(:PROC);
 use Data::Dumper;
 
@@ -1040,6 +1041,9 @@ sub check_type {
            return 1;
        } else {
            if ($vt) {
+               if ($type eq 'boolean' && JSON::is_bool($value)) {
+                   return 1;
+               }
                add_error($errors, $path, "type check ('$type') failed - got $vt");
                return undef;
            } else {