From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 64AD91FF0B6 for ; Thu, 12 Nov 2026 10:24:47 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 25F4421664; Thu, 12 Nov 2026 10:24:44 +0100 (CET) Date: Thu, 12 Nov 2026 10:24:34 +0100 From: Wolfgang Bumiller To: "Max R. Carrara" Subject: Re: [PATCH pve-common v4 01/17] json schema: add multiline string format Message-ID: References: <20261106154554.2182986-1-m.carrara@proxmox.com> <20261106154554.2182986-2-m.carrara@proxmox.com> <5b33c71e-8ed3-45dc-a106-c8b4f64e405a@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794475474349 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.347 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: AYF52QKHC2PSJKS53IJRSFOX57LIRUZ6 X-Message-ID-Hash: AYF52QKHC2PSJKS53IJRSFOX57LIRUZ6 X-MailFrom: w.bumiller@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 CC: Thomas Lamprecht , pve-devel@lists.proxmox.com, Alfonso Kuen , Thomas Ellmenreich , Jakob Klocker X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, Nov 11, 2026 at 02:50:39PM +0100, Max R. Carrara wrote: > On Wed Nov 11, 2026 at 12:38 PM CET, Thomas Lamprecht wrote: > > Am 11.11.26 um 11:56 schrieb Max R. Carrara: > > > On Tue Nov 10, 2026 at 2:39 PM CET, Wolfgang Bumiller wrote: > > >> Given that right now, newlines are almost never wanted/allowed in our > > >> API (apart from comments), there's a case to be made here that we might > > >> just want a multiline schema flag. (Where by default we'd reject > > >> newlines. This could potentially remove a whole class of possible future > > >> section-config related bugs…) > > > > > > If a fear of SectionConfig bugs is preventing us from simply adding > > > multiline strings, we should seriously consider migrating the > > > SectionConfig *file format* to something different in the long term. > > > > unescaped newline will cause issues in most (non-binary) formats, lets > > not overreact here... > > Many modern formats like TOML and HJSON support multiline string > literals. Or am I misunderstanding something here? This is not only about formats we can choose ourselves. Eg. the API can also manage `/etc/network/interfaces` where pretty much everything (other than the comments) could cause major issues if newlines are inserted. (Sure, this particular example requires privileges, but the point is that we don't always choose the format). > > > > > >> Also, consider that on the rust side, 'format', 'enum', 'pattern', and > > >> the verify-functions are part of the `ApiStringFormat` *enum*, so you > > >> can only have one, [...] > > > > > > Which is something we should change eventually then, since validation > > > keywords are independent unless explicitly stated otherwise, at least as > > > per section 3.1.1 of this draft: > > > > > > https://json-schema.org/draft-07/draft-handrews-json-schema-validation-00.pdf > > > > > > Sure, you could argue that it doesn't make sense to have `format`, > > > `enum`, and `pattern` co-exist for the same property, but the spec > > > doesn't place any restrictions on this. > > > > > > > > >> [...] and we do not have *named* formats at all. > > > > > > Why not? Because in rust the schema is meant to fully resolve at build-time. This isn't something I'd want to change just to allow newlines in a a probably-single-digit-amount of API parameters. > > > > > >> > > >> Thomas also played around with the thought of adding a multiline boolean > > >> to string schemas, so this may be a good time to come to a decision > > >> here. > > >> > > >> IMO, while not strictly being part of any JSONSchema/openapi spec, it > > >> would be fine to have that. Also, I'm quite sure that whenever we use > > >> patterns or other formats, a pattern which does not want to opt into > > >> multiline support should be written in a way which does not allow > > >> newlines *anyway*, so for the most part it would act as a hint, but > > >> additionally provide a safe-guard just in case. > > > > > > NAK -- I don't think we should deviate from the spec just to make a > > > > FWIW we're not exactly spec conform nor fully support all potential > > variants now and I hardly see why one has to bend backward to do either > > here. > > That's what I'm trying to point out here; we seem to "bend backward" to > adapt things like JSONSchema to SectionConfig, instead of doing it the > other way around. We're not bending backwards there, and SC is not the (only) reason either, it is just *one thing* which *exposes* (not *causes*) issues inherent to JSONSchema and where we use it. Look at the oneOf changes for example, and combine it with CLI option parsing, where we run into even more issues: One example being boolean flags. We accept `--a-bool 1`, but we also accept `--a-bool` without the 1, so what if you add a variant to an existing enum which *then* causes an option to be *maybe* a boolean? The shell-completion function suddenly gains a lot of complexity from this. You could argue that we simply "shouldn't" mess up the CLI → enter custom storage plugins ;-) Any addition/change to the schema *should* ideally take all such things into account as much as we possibly can. And a `multiline` *safeguard* doesn't seem to cause many such issues, and would not prevent it from being used with openapi tooling either. And besides, this series already introduces other `x-foo` options for the GUI, so it may as well have been `x-multline`.