From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 8E3DE1FF139 for ; Tue, 10 Feb 2026 09:25:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ECE7D189CA; Tue, 10 Feb 2026 09:26:16 +0100 (CET) Message-ID: Date: Tue, 10 Feb 2026 09:25:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [RFC proxmox v2] schema: add CommaSeparatedList wrapper type for comma-separated values To: Dietmar Maurer , pve-devel@lists.proxmox.com References: <20260209084554.70492-1-dietmar@proxmox.com> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <20260209084554.70492-1-dietmar@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770711858567 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.020 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: N7HCSGLOZAGTKF7B6NFDVILRH5LPQLDO X-Message-ID-Hash: N7HCSGLOZAGTKF7B6NFDVILRH5LPQLDO X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Am 09.02.26 um 09:45 schrieb Dietmar Maurer: > Introduce a new CommaSeparatedList wrapper type that provides > schema-aware serialization and deserialization of comma-separated > values, similar to PropertyString but designed for list/array types. > > Key components: > - CommaSeparatedListSchema trait: Provides the static ARRAY_SCHEMA > required for (de)serialization (workaround for unstable generic > const items in Rust) > - CommaSeparatedList: A transparent Vec newtype with Deref/ > DerefMut implementations for ergonomic access > > The wrapper automatically handles conversion between "1,2,3" string > representation and Vec while validating against the element schema. > > Signed-off-by: Dietmar Maurer > --- > > Changes in v2: > > - use description from ARRAY_SCHEMA > - add test for that > > > > proxmox-schema/src/comma_separated_list.rs | 173 +++++++++++++++++++++ > proxmox-schema/src/lib.rs | 1 + > 2 files changed, 174 insertions(+) > create mode 100644 proxmox-schema/src/comma_separated_list.rs > > diff --git a/proxmox-schema/src/comma_separated_list.rs b/proxmox-schema/src/comma_separated_list.rs > new file mode 100644 > index 00000000..381b17c5 > --- /dev/null > +++ b/proxmox-schema/src/comma_separated_list.rs > @@ -0,0 +1,173 @@ Would be nice to have a module-level rust doc for new modules with an usage example. As those doc examples are run on testing/build, if not excluded explicitly, they could also provide some (extra) coverage here. E.g., from a quick check the cases for empty list serializing to "" (or?) and a list with spaces after the comma are not tested as of now. > ... > +impl CommaSeparatedList { Is there any reason for limiting this to FromStr + Display ? The implementation does not depend on it and if one would have a type with Serialize + CommaSeparatedListSchema implemented, they couldn't use this constructor. If there's a reason behind doing this, it'd be nice to have a short comment here to describe why the type bounds are more limiting than necessary. > + pub fn new(inner: Vec) -> Self { > + Self(inner) > + } > + > + pub fn into_inner(self) -> Vec { > + self.0 > + } > +} > + > ... > diff --git a/proxmox-schema/src/lib.rs b/proxmox-schema/src/lib.rs > index 1647e8a9..fd773a84 100644 > --- a/proxmox-schema/src/lib.rs > +++ b/proxmox-schema/src/lib.rs > @@ -22,6 +22,7 @@ pub mod de; > pub mod format; > pub mod ser; > > +pub mod comma_separated_list; This makes the main type accessible under "proxmox_schema::comma_separated_list::CommaSeparatedList" which is rather redundant and IMO has not much benefits over re-exporting CommaSeparatedList directly to allow accessing it under proxmox_schema::CommaSeparatedList But no hard feelings, we got this "problem" quite a few times already.