my $type = $class->type();
my $pdata = $class->private();
+ die "duplicate plugin registration (type = $type)"
+ if defined($pdata->{plugins}->{$type});
+
my $plugindata = $class->plugindata();
$pdata->{plugindata}->{$type} = $plugindata;
$pdata->{plugins}->{$type} = $class;
};
foreach my $p (keys %$propertyList) {
- next if $p eq 'type';
if (!$propertyList->{$p}->{optional}) {
$props->{$p} = $propertyList->{$p};
next;
my $modifyable = 0;
+ my $copts = $class->options();
+ $modifyable = 1 if defined($copts->{$p}) && !$copts->{$p}->{fixed};
+
foreach my $t (keys %$plugins) {
my $opts = $pdata->{options}->{$t} || {};
next if !defined($opts->{$p});
}
$propertyList->{type}->{type} = 'string';
- $propertyList->{type}->{enum} = [keys %$plugins];
+ $propertyList->{type}->{enum} = [sort keys %$plugins];
}
sub lookup {
my $pdata = $class->private();
- return [ keys %{$pdata->{plugins}} ];
+ return [ sort keys %{$pdata->{plugins}} ];
}
sub decode_value {
my $ct = $schema->{type};
+ die "property '$key' contains a line feed\n"
+ if ($key =~ m/[\n\r]/) || ($value =~ m/[\n\r]/);
+
if ($ct eq 'boolean') {
- return $value ? "\t$key\n" : '';
+ return "\t$key " . ($value ? 1 : 0) . "\n"
+ if defined($value);
} else {
return "\t$key $value\n" if "$value" ne '';
}