From 9c2e403407ebec8e1ad946e190b86b40b8c2ca13 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 20 Feb 2017 12:40:33 +0100 Subject: [PATCH] SectionConfig: add new parameter $skip_type to createSchema() This is useful when there is only a single type of entries. --- src/PVE/SectionConfig.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm index bfe4f8b..e489b7c 100644 --- a/src/PVE/SectionConfig.pm +++ b/src/PVE/SectionConfig.pm @@ -51,7 +51,7 @@ sub plugindata { } sub createSchema { - my ($class) = @_; + my ($class, $skip_type) = @_; my $pdata = $class->private(); my $propertyList = $pdata->{propertyList}; @@ -71,6 +71,8 @@ sub createSchema { }; foreach my $p (keys %$propertyList) { + next if $skip_type && $p eq 'type'; + if (!$propertyList->{$p}->{optional}) { $props->{$p} = $propertyList->{$p}; next; -- 2.39.2