[pdm-devel] [PATCH proxmox-api-types 1/1] generator: support methods with no parameters

Stefan Hanreich s.hanreich at proxmox.com
Tue Feb 4 14:14:49 CET 2025


Some methods (e.g. 'PUT cluster/sdn') do not take any input
parameters. Support those methods by generating them with unit type as
type for the input parameters.

Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 pve-api-types/generator-lib/Schema2Rust.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
index 068517e..554341d 100644
--- a/pve-api-types/generator-lib/Schema2Rust.pm
+++ b/pve-api-types/generator-lib/Schema2Rust.pm
@@ -535,7 +535,8 @@ my sub print_method_with_body : prototype($$$$$) {
         my ($arg, $def) = @$url_arg;
         print {$out} "    $arg: $def->{type},\n";
     }
-    print {$out} "    params: $def->{input_type},\n";
+    my $input = $def->{input_type} // '()';
+    print {$out} "    params: $input,\n";
     my $output = $def->{output_type} // '()';
     print {$out} ") -> Result<$output, Error> {\n";
     if ($trait) {
-- 
2.39.5




More information about the pdm-devel mailing list