From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-common v1 19/23] sectionconfig: extend / correct docstring of `private()` method
Date: Fri, 19 Dec 2025 20:44:54 +0100 [thread overview]
Message-ID: <20251219194511.840583-20-m.carrara@proxmox.com> (raw)
In-Reply-To: <20251219194511.840583-1-m.carrara@proxmox.com>
At the end of the docstring, note that ..
* one really should only declare default properties as required in
very special cases, such as using a property as an identifier
* and that only attributes specific to PVE::JSONSchema should be
declared on default properties
The latter case in particular was mentioned off-list a while ago;
every default property must be defined through a valid JSONSchema, any
other attributes really shouldn't be added.
Also correct the example in this docstring along the way, correctly
quoting the key and adding `optional => 1` in order not to suggest
anything that is advised against in the new paragraph further below.
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
src/PVE/SectionConfig.pm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm
index 6ad8772..71a0019 100644
--- a/src/PVE/SectionConfig.pm
+++ b/src/PVE/SectionConfig.pm
@@ -138,9 +138,10 @@ More precisely, this method returns a hash with the following structure:
optional => 1,
description => 'example property',
},
- some-property => {
- description => 'another example property',
+ 'some-property' => {
type => 'boolean'
+ optional => 1,
+ description => 'another example property',
},
},
options => {
@@ -204,6 +205,19 @@ plugin architecture upfront, for example:
Additional properties defined in I<child plugins> are stored in the
C<propertyList> key. See C<L<< properties()|/$plugin->properties() >>>.
+B<NOTE:> It is advised to mark all default properties in C<propertyList> as
+optional using C<< optional => 1 >>, with only very few exceptions. One such
+exception would be a property that you intend to use as unique identifier of a
+section. In that case, ensure that you explicitly define it with
+C<< optional => 0 >> and that it is not used in any child plugins'
+C<L<< options()|/$plugin->options() >>> method.
+
+B<NOTE:> When specifying the default properties in the C<propertyList> key, you
+MAY only add attributes related to C<L<PVE::JSONSchema>> to property
+definitions. Any other attributes, even those specific to C<PVE::SectionConfig>
+(like C<fixed>), are not considered valid. All properties in C<propertyList>
+MUST be defined through a valid JSONSchema.
+
=cut
sub private {
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-12-19 19:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 19:44 [pve-devel] [PATCH pve-common v1 00/23] Document PVE::SectionConfig Peculiarities Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 01/23] sectionconfig: remove unused variable in get_property_schema() Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 02/23] tests: sectionconfig: add comparison test structure Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 03/23] tests: sectionconfig: add test case for fixed props in updateSchema Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 04/23] tests: sectionconfig: add case for unused properties Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 05/23] tests: sectionconfig: add case for unused optional default properties Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 06/23] tests: sectionconfig: add case for opt. default prop being req. once Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 07/23] tests: sectionconfig: add case for opt. default prop requirde by all Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 08/23] tests: sectionconfig: add case for unused required default properties Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 09/23] tests: sectionconfig: add case for req. default prop being req. once Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 10/23] tests: sectionconfig: add case for required default prop req. by all Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 11/23] tests: sectionconfig: add case for required default props opt. for all Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 12/23] tests: sectionconfig: add isolated mode test structure Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 13/23] tests: sectionconfig: add case for an ident. prop on two plugins Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 14/23] tests: sectionconfig: add case for same prop. w/ different optionality Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 15/23] tests: sectionconfig: add case for differing opt. default prop uses Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 16/23] tests: sectionconfig: add case for differing req. " Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 17/23] sectionconfig: correct docs regarding global props in unified mode Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 18/23] sectionconfig: reword docs regarding property usage in isolated mode Max R. Carrara
2025-12-19 19:44 ` Max R. Carrara [this message]
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 20/23] sectionconfig: note that a prop must be defined through a JSONSchema Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 21/23] sectionconfig: note that props added by plugins are always optional Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 22/23] sectionconfig: note that `createSchema()` is universal for all plugins Max R. Carrara
2025-12-19 19:44 ` [pve-devel] [PATCH pve-common v1 23/23] sectionconfig: correct example in docstring of `updateSchema()` Max R. Carrara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251219194511.840583-20-m.carrara@proxmox.com \
--to=m.carrara@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox