[pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional

Hannes Laimer h.laimer at proxmox.com
Fri Nov 28 09:07:33 CET 2025


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 at 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





More information about the pdm-devel mailing list