all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional
Date: Fri, 28 Nov 2025 09:07:33 +0100	[thread overview]
Message-ID: <20251128080733.43974-1-h.laimer@proxmox.com> (raw)

When a URL path parameter (e.g. .../rules/{pos}) shares a name with a schema
field that is marked as optional, the generator incorrectly wrapped the
path parameter in `Option<T>`.

Remove the logic that applies the schema's optionality to URL parameters,
ensuring they are always generated as required types.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 pve-api-types/generator-lib/Schema2Rust.pm | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
index ab1c1700..52493375 100644
--- a/pve-api-types/generator-lib/Schema2Rust.pm
+++ b/pve-api-types/generator-lib/Schema2Rust.pm
@@ -1656,10 +1656,6 @@ my sub method_parameters : prototype($$$$$) {
             $def->{type} = '&str';
         }
 
-        if ($def->{optional}) {
-            $def->{type} = "Option<$def->{type}>";
-        }
-
         push @$url_param_defs, [$param, $def];
     }
     $def->{url_params} = $url_param_defs;
-- 
2.47.3



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


                 reply	other threads:[~2025-11-28  8:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20251128080733.43974-1-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pdm-devel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal