* [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional
@ 2025-11-28 8:07 Hannes Laimer
0 siblings, 0 replies; only message in thread
From: Hannes Laimer @ 2025-11-28 8:07 UTC (permalink / raw)
To: pdm-devel
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-11-28 8:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-28 8:07 [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional Hannes Laimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox