[pdm-devel] applied: [PATCH proxmox-api-types 1/3] Schema2Rust: fix handling of non-optional params

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Sep 3 10:57:56 CEST 2025


applied, thanks

On Tue, Sep 02, 2025 at 05:14:19PM +0200, Lukas Wagner wrote:
> Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
> ---
>  pve-api-types/generator-lib/Schema2Rust.pm | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
> index 77cb373..436ba76 100644
> --- a/pve-api-types/generator-lib/Schema2Rust.pm
> +++ b/pve-api-types/generator-lib/Schema2Rust.pm
> @@ -497,8 +497,10 @@ my sub print_method_without_body : prototype($$$$$) {
>                  print {$out} "        .maybe_bool_arg(\"$name\", p_$rust_name)\n";
>              } elsif ($arg->{is_string_list}) {
>                  print {$out} "        .maybe_list_arg(\"$name\", p_$rust_name)\n";
> -            } else {
> +            } elsif ($arg->{optional}) {
>                  print {$out} "        .maybe_arg(\"$name\", &p_$rust_name)\n";
> +            } else {
> +                print {$out} "        .arg(\"$name\", &p_$rust_name)\n";
>              }
>          }
>          print {$out} "        .build();\n";
> @@ -517,12 +519,15 @@ my sub print_method_without_body : prototype($$$$$) {
>              for my $arg (@$input) {
>                  my $name = $arg->{name};
>                  my $rust_name = $arg->{rust_name};
> +
>                  if ($arg->{type} eq 'Option<bool>') {
>                      print {$out} "        .maybe_bool_arg(\"$name\", $rust_name)\n";
>                  } elsif ($arg->{is_string_list}) {
>                      print {$out} "        .maybe_list_arg(\"$name\", &$rust_name)\n";
> -                } else {
> +                } elsif ($arg->{optional}) {
>                      print {$out} "        .maybe_arg(\"$name\", &$rust_name)\n";
> +                } else {
> +                    print {$out} "        .arg(\"$name\", &$rust_name)\n";
>                  }
>              }
>              print {$out} "        .build();\n";
> -- 
> 2.47.2




More information about the pdm-devel mailing list