From: Hannes Laimer <h.laimer@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox] Schema2Rust: handle missing parameters->properties
Date: Fri, 26 Sep 2025 14:59:40 +0200 [thread overview]
Message-ID: <20250926125940.177661-1-h.laimer@proxmox.com> (raw)
We crashed if we encountered
```
parameters => {
additionalProperties => 0,
},
```
almost all endpoint specify this explicitly, so
```
parameters => {
additionalProperties => 0,
properties => {},
},
```
I found at least these
- `/cluster/firewall/options`
- `/cluster/firewall/macros`
to be exceptions to this, there may be more.
Our api-macro does also not need this to be specified explicitly,
therefore we have the generator infer `properties => {}` in case it is
not specified explicitly, i.e. it is missing.
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
pve-api-types/generator-lib/Schema2Rust.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
index 0f3efc0a..7d600ae7 100644
--- a/pve-api-types/generator-lib/Schema2Rust.pm
+++ b/pve-api-types/generator-lib/Schema2Rust.pm
@@ -1561,13 +1561,13 @@ my sub method_parameters : prototype($$$$$) {
my $url_params = url_parameters($api_url);
- my $parameters = $api_method->{parameters};
+ my $parameters = $api_method->{parameters} // {};
#print "URL PARAMETERS: ".join(', ', $url_params->@*)."\n";
# Clone to avoid modifying the duplicate.
$parameters = { $parameters->%* };
- my $properties = { $parameters->{properties}->%* };
+ my $properties = { ($parameters->{properties} // {})->%* };
$parameters->{properties} = $properties;
# Handle URL parameter types. These should only be strings or integers.
--
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-09-26 13:00 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=20250926125940.177661-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.