[pve-devel] [PATCH common v2 02/32] json schema: add helper to convert to JSON boolean

Fiona Ebner f.ebner at proxmox.com
Wed Jun 18 15:01:39 CEST 2025


Suggested-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

New in v2.

 src/PVE/JSONSchema.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index e617fc1..43e0ca0 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -21,6 +21,7 @@ our @EXPORT_OK = qw(
     get_standard_option
     parse_property_string
     print_property_string
+    json_bool
 );
 
 our $CONFIGID_RE = qr/[a-z][a-z0-9_-]+/i;
@@ -2513,4 +2514,10 @@ sub schema_get_type_text {
     return "<$type>";
 }
 
+sub json_bool {
+    my ($value) = @_;
+
+    return $value ? JSON::true : JSON::false;
+}
+
 1;
-- 
2.39.5





More information about the pve-devel mailing list