public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Stefan Hanreich <s.hanreich@proxmox.com>
Cc: pdm-devel@lists.proxmox.com
Subject: Re: [pdm-devel] [PATCH proxmox-api-types 1/1] generator: support methods with no parameters
Date: Wed, 5 Feb 2025 14:03:55 +0100	[thread overview]
Message-ID: <qxua3bqdlqcdgg2eebodmxrybokpt23w53cvdt3qaekbvewzee@yuas5uessjhf> (raw)
In-Reply-To: <20250204131449.125443-1-s.hanreich@proxmox.com>

On Tue, Feb 04, 2025 at 02:14:49PM +0100, Stefan Hanreich wrote:
> 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@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";

This would produce an explicit parameter of type `()` - why not just
drop `params` when we have none?

>      my $output = $def->{output_type} // '()';
>      print {$out} ") -> Result<$output, Error> {\n";
>      if ($trait) {
> -- 
> 2.39.5


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  reply	other threads:[~2025-02-05 13:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 13:14 Stefan Hanreich
2025-02-05 13:03 ` Wolfgang Bumiller [this message]
2025-02-05 13:39   ` Stefan Hanreich
2025-02-05 14:01     ` Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=qxua3bqdlqcdgg2eebodmxrybokpt23w53cvdt3qaekbvewzee@yuas5uessjhf \
    --to=w.bumiller@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    --cc=s.hanreich@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal