all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: handle `ref` keyword like we do `macro`
@ 2025-11-28 14:25 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 14:25 UTC (permalink / raw)
  To: pdm-devel

Firewall refs have a field named `ref`, this would trip up the
generated rust code. This fixes that.

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

diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm
index 52493375..2bdb33d9 100644
--- a/pve-api-types/generator-lib/Schema2Rust.pm
+++ b/pve-api-types/generator-lib/Schema2Rust.pm
@@ -127,7 +127,7 @@ sub api_to_string : prototype($$$$$) {
         local $API_TYPE_POS = "$API_TYPE_POS/$key";
 
         # We need to quote keys with hyphens or reserved keywords:
-        my $safe_key = (($key =~ /-/) || ($key eq 'macro')) ? "\"$key\"" : $key;
+        my $safe_key = (($key =~ /-/) || ($key eq 'macro') || ($key eq 'ref')) ? "\"$key\"" : $key;
 
         if (exists($API_TYPE_OVERRIDES{$API_TYPE_POS})) {
             $value = $API_TYPE_OVERRIDES{$API_TYPE_POS};
@@ -172,7 +172,7 @@ sub api_to_string : prototype($$$$$) {
                 warn "api type extension for $API_TYPE_POS.$key already in schema, skipping\n";
                 next;
             }
-            my $safe_key = (($key =~ /-/) || ($key eq 'macro')) ? "\"$key\"" : $key;
+            my $safe_key = (($key =~ /-/) || ($key eq 'macro') || ($key eq 'ref')) ? "\"$key\"" : $key;
             my $value = $extra->{$key};
             print {$out} "${indent}$safe_key: $value,\n";
         }
@@ -730,6 +730,7 @@ sub namify_field : prototype($) {
 
     return 'ty' if $out eq 'type';
     return 'r#macro' if $out eq 'macro';
+    return 'r#ref' if $out eq 'ref';
 
     return $out;
 }
-- 
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: handle `ref` keyword like we do `macro`
  2025-11-28 14:25 [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: handle `ref` keyword like we do `macro` 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 15:25:16 +0100, Hannes Laimer wrote:
> Firewall refs have a field named `ref`, this would trip up the
> generated rust code. This fixes that.
> 
> 

Applied, thanks!

[1/1] pve-api-types: schema2rust: handle `ref` keyword like we do `macro`
      commit: 99eeddebd8afe8abdfbf62e8ff3f440b28a75608


_______________________________________________
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 14:25 [pdm-devel] [PATCH proxmox] pve-api-types: schema2rust: handle `ref` keyword like we do `macro` Hannes Laimer
2025-12-01  3:29 ` [pdm-devel] applied: " Thomas Lamprecht

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