[pve-devel] [RFC pve-common 0/4] Typetext generation

Wolfgang Bumiller w.bumiller at proxmox.com
Mon Sep 21 12:11:04 CEST 2015


We have a lot of types which are really objects (comma separated lists
of key-value pairs), which aren't always checked properly.
This patch adds support to generate a typetext property from a schema.
The intention is to specify a schema instead of a typetext and have
the typetext generated, while the schema is being used for
verification.

Note: Currently this means only the type-information and
format_description/typetext info is used from the string's inner
schema.
Should we maybe add general support for hash-refs as `format` for
string types?
Usable Like:
{
    ...
    mp0 => {
        type => 'string',
        format => {
            volume => {
                type => 'string',
                # the 'volume=' part is optional
                typetext => '[volume=]volume',
                description => 'Volume, device or path to mount.',
            },
            mp => {
                type => 'string',
                format_description => 'Path',
                description => 'Mountpoint inside the container',
            },
        },
    },
    ...
}

That way the description could be included in generated documentation.

Also note: the last patch in the series is for pending changes in
pve-container which will use the new generate_typetext and
check_object_warn functions.

Wolfgang Bumiller (4):
  JSONSchema: format_description + generate_typetext
  JSONSchema::generate_typetext: raw typetext support
  JSONSchema::check_object_warn
  JSONSchema: pve-ipv4/6-config and CIDR split

 src/PVE/JSONSchema.pm | 109 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 104 insertions(+), 5 deletions(-)

-- 
2.1.4





More information about the pve-devel mailing list