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 7F5ED1FF183 for ; Wed, 5 Nov 2025 11:43:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7F0E220962; Wed, 5 Nov 2025 11:44:33 +0100 (CET) Date: Wed, 5 Nov 2025 11:44:00 +0100 From: Wolfgang Bumiller To: Hannes Laimer Message-ID: References: <20251023141956.106640-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20251023141956.106640-1-h.laimer@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762339422613 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.079 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [schema2rust.pm] Subject: [pdm-devel] applied: [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 Cc: pdm-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" applied, thanks On Thu, Oct 23, 2025 at 04:19:56PM +0200, Hannes Laimer wrote: > 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