From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id EF67D1FF165 for ; Thu, 23 Oct 2025 16:19:34 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 012B0C0C4; Thu, 23 Oct 2025 16:20:01 +0200 (CEST) From: Hannes Laimer To: pdm-devel@lists.proxmox.com Date: Thu, 23 Oct 2025 16:19:56 +0200 Message-ID: <20251023141956.106640-1-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1761229191279 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.043 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH proxmox v2] pve-api-types: schema2rust: handle `macro` keyword like we do `type` X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Firewall rules have a field named `macro`, this would trip up the generated rust code. This fixes that. Signed-off-by: Hannes Laimer --- v2: - include quoting of `macro`, this was missing in v1 but is needed pve-api-types/generator-lib/Schema2Rust.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pve-api-types/generator-lib/Schema2Rust.pm b/pve-api-types/generator-lib/Schema2Rust.pm index c5ac4aad..9b984abb 100644 --- a/pve-api-types/generator-lib/Schema2Rust.pm +++ b/pve-api-types/generator-lib/Schema2Rust.pm @@ -125,8 +125,8 @@ sub api_to_string : prototype($$$$$) { local $API_TYPE_POS = "$API_TYPE_POS/$key"; - # We need to quote keys with hyphens: - my $safe_key = ($key =~ /-/) ? "\"$key\"" : $key; + # We need to quote keys with hyphens or reserved keywords: + my $safe_key = (($key =~ /-/) || ($key eq 'macro')) ? "\"$key\"" : $key; if (exists($API_TYPE_OVERRIDES{$API_TYPE_POS})) { $value = $API_TYPE_OVERRIDES{$API_TYPE_POS}; @@ -171,7 +171,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\"" : $key; + my $safe_key = (($key =~ /-/) || ($key eq 'macro')) ? "\"$key\"" : $key; my $value = $extra->{$key}; print {$out} "${indent}$safe_key: $value,\n"; } @@ -713,6 +713,7 @@ sub namify_field : prototype($) { } return 'ty' if $out eq 'type'; + return 'r#macro' if $out eq 'macro'; return $out; } -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel