public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional
@ 2025-11-28  8:07 Hannes Laimer
  2025-12-01  3:29 ` [pdm-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* [pdm-devel] applied: [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional
  2025-11-28  8:07 [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: don't mark URL parameters as optional Hannes Laimer
@ 2025-12-01  3:29 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-12-01  3:29 UTC (permalink / raw)
  To: pdm-devel, Hannes Laimer

On Fri, 28 Nov 2025 09:07:33 +0100, Hannes Laimer wrote:
> 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.
> 
> [...]

Applied, thanks!

[1/1] pve-api-types: schema2rust: don't mark URL parameters as optional
      commit: 2f33df3aa4c8f2d18af21d6ad9b5ad42ac456a3c


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-01  3:29 UTC | newest]

Thread overview: 2+ messages (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
2025-12-01  3:29 ` [pdm-devel] applied: " Thomas Lamprecht

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